Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Migrated] Add a command for setting environment variables. #678

Closed
2 tasks
jneves opened this issue Feb 20, 2021 · 1 comment
Closed
2 tasks

[Migrated] Add a command for setting environment variables. #678

jneves opened this issue Feb 20, 2021 · 1 comment

Comments

@jneves
Copy link
Contributor

jneves commented Feb 20, 2021

Originally from: Miserlou/Zappa#1731 by youcandanch

TODO

  • Add tests around new command.
  • Solicit feedback on naming.

Description

This is a little bit of a divergence from what was brought up in #837, but I think it's another avenue for how to solve the problem as described in that issue. This PR introduces a new command: zappa set-environment-variable. I'm a little concerned that the name is over-verbose, but figured I'd err on the side of being as explicit as possible.

For our particular use case, this would be valuable in CI for updating variables we expect in each environment (things like the SHA associated with the release, the time of deployment, etc.), but I can imagine it'd be helpful for a few different reasons.

The command takes three arguments:
--key: the key of the environment variable to set
--value: the value to set the environment variable to
--overwrite: a boolean indicating that, if an environment variable already exists with the provided key, it should be overwritten. In the absence of this flag, a KeyError will be raised. (I'm not that thrilled with using KeyError, but couldn't think of anything better.

Tested as working in 2.7 and 3.6 (and 3.7, with a quick __init__.py tweak, since 3.7 support is coming down the pipeline).

GitHub Issues

Miserlou/Zappa#837

@monkut
Copy link
Collaborator

monkut commented Aug 18, 2022

It may be helpful to have a utility command, but I think at the moment it's out of scope.

I've created a gist that does what you are looking for though... really I think the AWS cli should make it easier to set envars for lambda though.

https://gist.github.com/monkut/cd16a8c532694bac4383d53978a47373

@monkut monkut closed this as completed Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants