Providing s3.getKey option when running Companion in standalone mode

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.

    s3: {
      getKey: (req, filename) => filename,
      key: "***",
      secret: "***",
      bucket: "bucket-name",
      region: "us-east-1"

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

return {
  s3: {
    key: process.env.COMPANION_AWS_KEY,
    secret: getSecret('COMPANION_AWS_SECRET'),
    bucket: process.env.COMPANION_AWS_BUCKET,
    endpoint: process.env.COMPANION_AWS_ENDPOINT,
    region: process.env.COMPANION_AWS_REGION,
    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.

- Andrew