Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove s3 endpoints if s3 disabled #4675

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@uppy/companion/src/companion.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module.exports.app = (optionsArg = {}) => {
// add uppy options to the request object so it can be accessed by subsequent handlers.
app.use('*', middlewares.getCompanionMiddleware(options))
app.use('/s3', s3(options.s3))
app.use('/url', url())
if (options.enableUrlEndpoint) app.use('/url', url())

app.post('/:providerName/preauth', express.json(), express.urlencoded({ extended: false }), middlewares.hasSessionAndProvider, middlewares.hasBody, middlewares.hasOAuthProvider, controllers.preauth)
app.get('/:providerName/connect', middlewares.hasSessionAndProvider, middlewares.hasOAuthProvider, controllers.connect)
Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/companion/src/config/companion.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const defaultOptions = {
getKey: defaultGetKey,
expires: 800, // seconds
},
enableUrlEndpoint: true, // todo next major make this default false
allowLocalUrls: false,
logClientVersion: true,
periodicPingUrls: [],
Expand Down
4 changes: 4 additions & 0 deletions packages/@uppy/companion/src/server/controllers/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ module.exports = function s3 (config) {
}, next)
}

if (config.bucket == null) {
return express.Router() // empty router because s3 is not enabled
}

return express.Router()
.get('/sts', getTemporarySecurityCredentials)
.get('/params', getUploadParameters)
Expand Down
2 changes: 2 additions & 0 deletions packages/@uppy/companion/src/standalone/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ const getConfigFromEnv = () => {
oauthDomain: process.env.COMPANION_OAUTH_DOMAIN,
validHosts,
},
// todo next major make this default false
enableUrlEndpoint: process.env.COMPANION_ENABLE_URL_ENDPOINT == null || process.env.COMPANION_ENABLE_URL_ENDPOINT === 'true',
periodicPingUrls: process.env.COMPANION_PERIODIC_PING_URLS ? process.env.COMPANION_PERIODIC_PING_URLS.split(',') : [],
periodicPingInterval: process.env.COMPANION_PERIODIC_PING_INTERVAL
? parseInt(process.env.COMPANION_PERIODIC_PING_INTERVAL, 10) : undefined,
Expand Down