Environment Variables
To create different environment variables per stage is easy with the Gothic Framework. Declare each stage under Deploy.Providers.AWS.Stages (or Deploy.Providers.GCP.Stages on the GCP target) in your gothic.config.go, and set each variable with the gothic.Env(...) builder for a plain literal value, as shown below.
For a value that must stay out of the config, use gothic.SecretsManager(...) on either target: only the secret name or path sits in the config, and the value is resolved for you. gothic.SSMParam reads AWS Parameter Store and is AWS-only. The next pages cover both.
Stages: map[string]gothic.Stage{
"dev": {
ENV: map[string]gothic.EnvValue{
"MyEnvVar1": gothic.Env("my-env-var-1-dev"),
},
},
"qa": {
ENV: map[string]gothic.EnvValue{
"MyEnvVar1": gothic.Env("my-env-var-1-qa"),
},
},
"prod": {
ENV: map[string]gothic.EnvValue{
"MyEnvVar1": gothic.Env("my-env-var-1-prod"),
},
},
},Did you like this session of how to deploy your app with custom environment variables per stage? Check out how to get your environment variables in a secure way using AWS Parameter Store!