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

updated config to runtime model #986

Closed
wants to merge 1 commit into from
Closed

updated config to runtime model #986

wants to merge 1 commit into from

Conversation

pjdiiori
Copy link

@pjdiiori pjdiiori commented May 13, 2021

connects to #929

Description: Changed "releases.exs" to "runtime.exs"

Also put configurations within a if config_env() == :prod do block.

Reviewer don't-forgets:

  • Test coverage feels appropriate, given potential risk
  • We're not doubling down on already-bad code
  • If there are web UI changes, they don't add anything that could be considered client-side page navigation (unless pre-approved as being necessary by another engineer)
  • If there are web UI changes, they don't add any AJAX form submits (unless pre-approved as being necessary by another engineer)
  • If there are any lint rules disabled, they are disabled per-line, and were (in the reviewer's judgment) appropriate to disable
  • Any new environment variables used in the app are both documented and have been added to both staging and production environments already
  • Potential race conditions are either inconsequential, or the code prevents them from occurring.
  • If this is a UI change that called for screenshots/GIFs, in the reviewer's judgement, they were included

@stuartish stuartish requested a review from grossvogel May 13, 2021 20:32
Copy link
Contributor

@grossvogel grossvogel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the right thing to me, thanks for doing this!!!

(Next I want to remove instances of System.get_env() from the other config files where they're just misleading 😈 )

@pjdiiori
Copy link
Author

(Next I want to remove instances of System.get_env() from the other config files where they're just misleading 😈 )

@grossvogel Could you elaborate on this or maybe even pair with me on it to explain if you have time?

@grossvogel
Copy link
Contributor

@pjdiiori yeah, Elixir has a profusion of config files:

  • config.exs applies generally for every environment (compile-time)
  • prod.exs, dev.exs, and test.exs apply for to a specific environment (compile-time)
  • dev.secret.exs is used for local development (compile-time ~= runtime when running locally via mix)
  • runtime.exs (or previously releases.exs) is used when starting up a release (runtime)

System.get_env('ABC') is used to load system environment variables into those config files, but the difference between runtime and compile-time is super important when using environment variables. If you use environment variables in any of those compile-time files, then you might be surprised at what comes out. Everything we deploy gets compiled in a docker build in our CI jobs in travis, meaning the environment variables you get in compile-time config come from that build environment. What we really want is to use environment variables provided to your app in the deployment environment, at runtime. So it usually only makes sense to use System.get_env() in runtime.exs.

@revelry-stalebot
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@revelry-stalebot revelry-stalebot bot closed this Jun 23, 2021
@grossvogel grossvogel reopened this Aug 6, 2021
@revelry-stalebot revelry-stalebot bot removed the stale label Aug 6, 2021
@revelry-stalebot
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Copy link

@ZachFontenot ZachFontenot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MERGE IT

@stuartjohnpage
Copy link
Contributor

I'm trying to merge this, I think once I merge #1036 this should be good to be merged

@pjdiiori
Copy link
Author

pjdiiori commented Dec 1, 2021

😅 totally forgot about this. thanks @stuartjohnpage

@stuartjohnpage
Copy link
Contributor

No worries! On the other hand...is this based on a fork of the repo??

@pjdiiori
Copy link
Author

pjdiiori commented Dec 1, 2021

Whoops. Yeah I accidentally forked the repo and pointed it at main. closing this. new PR here: #1037

@pjdiiori pjdiiori closed this Dec 1, 2021
@pjdiiori pjdiiori deleted the update-config branch December 1, 2021 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants