I’m trying to run
companion in standalone mode with options supplied as a JSON file. But one particular option that I’m interested in overriding cannot be passed as JSON. This is the
getKey option used to determine the key of the uploaded file in my S3 bucket.
getKey: (req, filename) => filename,
Is my only option to wrap Companion with my own Express app and override the option in the bootstrap process or is there a workaround?
Currently, there is no way to set the
getKey method from environment variables or JSON file. After looking through the source code of the utility that retrieves the options, there is no option for it. Here is the relevant snippet of code
useAccelerateEndpoint: process.env.COMPANION_AWS_USE_ACCELERATE_ENDPOINT === 'true',
expires: parseInt(process.env.COMPANION_AWS_EXPIRES || '300', 10),
acl: process.env.COMPANION_AWS_ACL || 'public-read'
It seems that your only option is to wrap the code in an express server. Good luck!
If you have any further questions or issues, don’t hesitate to let me know.