Skip to content

Recommended way to deal with environment variables in a nx-monorepo #404

Answered by cogwirrel
zetashift asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! It usually depends a bit on the use case :)

For database DSNs and access tokens I'd do the same of injecting via lambda environment variables in CDK :) Note that for anything secret it's usually best to use secrets manager and pass the secret arn as an environment variable instead of the plaintext value, then retrieve the secret with the AWS SDK in the lambda function itself :)

For an API url - if you want to pass that to say a website you can make use of the runtimeOptions in the StaticWebsite CDK construct, which lets you pass the value from CDK down to the website when it first loads :)

Hope that helps! :)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@zetashift
Comment options

@cogwirrel
Comment options

@zetashift
Comment options

@cogwirrel
Comment options

Answer selected by zetashift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants