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

fix: better defined & documented .env and ENV_VAR support #14

Merged
merged 5 commits into from
Jul 11, 2023
Merged

Conversation

Pinjasaur
Copy link
Owner

This closes #13.

Briefly: from the beginning I had defined a .env inside the repo which got sourced along with any other supplied .env file at generation time. This was incredibly convenient, especially when building and testing locally. However, I never really liked that for the SITE_* variables, which were more or less required for the Full Opinionated Experience™, there was the potential to just have the mostly-useless ones hanging out.

And more frustratingly, because the .env was always sourced it would override anything defined at runtime e.g. SITE_URL=http://domain.tld bic .

This work fixes all that up by leaving an effectively-empty repo .env and having any defaults defined ${VAR:-default}-style in bic itself and simply printing a warning message if the important SITE_* aren't defined. Further, if someone wanted to define a variable in their .env and have it be overridable at runtime this can be done with

VAR="${VAR:-default}"

My motivation to keep the repo .env around is maybe I'll want it in the future e.g. some build metadata. Alternatively, I could use the aforementioned syntax to define the optional config (BUILD_DIR, DATE_FORMAT, SALT, and TIMEZONE) but as it stands I'd rather leave those in the source code.

@mfossen
Copy link
Contributor

mfossen commented Jul 10, 2023

LGTM

@Pinjasaur Pinjasaur merged commit 8cb608c into master Jul 11, 2023
@Pinjasaur Pinjasaur deleted the env-var branch July 11, 2023 01:28
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.

ENV_VAR support
2 participants