Is there a way to set environment variable in `sst...
# sst
j
Is there a way to set environment variable in
sst.Queue
?
Copy code
const queue = new sst.Queue(this, queueName, {
      consumer: 'src/queueConsumer.main',   // this handler expects a secret from env var
    })
f
Hey @JJ Teoh, like this
Copy code
const queue = new sst.Queue(this, queueName, {
  consumer: {
    function: {
      handler: 'src/queueConsumer.main',
      environment: {
        MY_SECRET: "foo",
      },
    },
  },
})
If all of your functions needs this secret, u can set it for all functions in the App or in a Stack using
App.setDefaultFunctionProps()
or
Stack.setDefaultFunctionProps()
a
Why queue will need en vars?