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

Consider a different way to load local environment vars #136

Open
lorenyu opened this issue Feb 9, 2023 · 1 comment
Open

Consider a different way to load local environment vars #136

lorenyu opened this issue Feb 9, 2023 · 1 comment
Labels
enhancement New feature or request maintenance

Comments

@lorenyu
Copy link
Contributor

lorenyu commented Feb 9, 2023

The load_local_env_vars module seems unnecessary and is weird that we call that function in prod (it's a no-op). It creates a situation where local code branch is different from prod code based on environment variables.

One idea

If we rename local.env to dotenv then it will automatically load.

Pros:

  • This will also help remove code branches that differ between local and prod systems.
  • This will allow local developers to have their personal config changes without accidentally committing it and messing up other people's configs. Shared configs can still go in something like .env.template.

Cons:

  • The con is that new config changes will need to be communicated to devs so they can pull new config changes from .env.template.

More context

Also see this PR discussion https://github.com/navapbc/template-application-flask/pull/138/files#r1105922982

@lorenyu lorenyu changed the title Move local.env to .env so it auto loads Consider moving local.env to .env so it auto loads Feb 9, 2023
@lorenyu lorenyu changed the title Consider moving local.env to .env so it auto loads Consider a different way to load local environment vars Feb 21, 2023
@lorenyu lorenyu added enhancement New feature or request maintenance labels Jun 9, 2023
@lorenyu
Copy link
Contributor Author

lorenyu commented Jun 15, 2023

Another possibility for running on local host machine would be to let developers rely on tools that appropriately set environment variables in the shell. direnv is a good tool for this. We can have developers install direnv and then have an .envrc file that sources the local.env file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request maintenance
Projects
None yet
Development

No branches or pull requests

1 participant