Hello everyone ! I'm new to SST and comes from ser...
# sst
u
Hello everyone ! I'm new to SST and comes from serverless framework I was looking for information if it was possible to have custom parameters like serverless framework in the custom part. I would like to do something like that.
Copy code
npx sst deploy --myParameters myValue
f
Hi @Uncharted, are you referring to CloudFormation parameters by the
serverless-parameters
plugin?
u
it seems that with sst you can only use stage and region options
f
Ah the cli options. Yeah, currently there isn’t a way to that in SST.
What’s your use case? Are you trying to configure something that’s stage-specific?
u
hello Franck for example for our environment we used a cli option called login to generate a domain
domain:
    
local: ${self:custom.login}.<http://mycompany.io|mycompany.io>
and our developers could type the command sls deploy --stage dev --login mylogin you may want some flexibility to provision your infra depending of some cli options for example the size of your cluster etc from what I read the only options available is to use the environment variables and properties files per environment ?
f
Hey @Uncharted, we just added
.env
support in v0.13.0, so you can define stage specific configs (ie. domain and other infra settings) like this:
Copy code
# .env.dev
DOMAIN=<http://dev.mycompany.io|dev.mycompany.io>

# .env.prod
DOMAIN=<http://prod.mycompany.io|prod.mycompany.io>
And a developer can override it with their personal config:
Copy code
# .env.local
DOMAIN=<http://frank.mycompany.io|frank.mycompany.io>
And in the code, you can reference it like:
Copy code
process.env.DOMAIN
You can also override it in the command line:
Copy code
$ DOMAIN=<http://frank.mycompany.io|frank.mycompany.io> sst start
With SST you are defining your infrastructure with real code (as opposed to yaml), so it’s really easy to configure resource settings conditionally. So I’m holding off adding support for command line parameters.
I opened a discussion here https://github.com/serverless-stack/serverless-stack/discussions/336 If you find a use case for which cli params works great, please bring it up. I will bump up the priority on this.