Add the ability to define a default value for undefined parameters#6
Add the ability to define a default value for undefined parameters#6hschimpf wants to merge 4 commits intobrefphp:mainfrom
Conversation
* Mock a custom SSM client to return a result with InvalidParameters
|
Thanks for the PR! I'm afraid this is extra logic to maintain, and the feature doesn't have great DX (creating a special syntax) 🤔 What is the use case for you? Where have you seen that need? |
As serverless allows to set default values on variables, I already have some variables that have a default value when it's not present on the For example, these are my current serverless.yml provider:
environment:
DB_HOST: ${env:SLS_DB_HOST}
DB_DATABASE: ${env:SLS_DB_DATABASE, self:custom.UUID}
DB_USERNAME: ${env:SLS_DB_USERNAME, self:custom.UUID}
DB_PASSWORD: ${env:SLS_DB_PASSWORD}
custom:
UUID: ${self:service}-${self:provider.stage}The I want to update those values to serverless.yml provider:
environment:
DB_HOST: bref-ssm:/${param:UUID}/DB_HOST
DB_PORT: bref-ssm:/${param:UUID}/DB_PORT,3306
DB_DATABASE: bref-ssm:/${param:UUID}/DB_DATABASE,${self:custom.UUID}
DB_USERNAME: bref-ssm:/${param:UUID}/DB_USERNAME,${self:custom.UUID}
DB_PASSWORD: bref-ssm:/${param:UUID}/DB_PASSWORD
custom:
UUID: ${self:service}-${self:provider.stage} |
juanbernal123
left a comment
There was a problem hiding this comment.
Thanks for the solution, it worked for me in my project !!
Hello!
I'm thinking about the possibility to define a default value for parameters that don't exist on SSM.
Just have one question:
What character we could define as separator for the parameter name and the default value?
Since the name can't have the colon symbol in it, you think that it could be the separator @mnapoli?