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

Add Freckle.App.Env.kept #65

Merged
merged 3 commits into from
Jun 13, 2022
Merged

Add Freckle.App.Env.kept #65

merged 3 commits into from
Jun 13, 2022

Conversation

pbrisbin
Copy link
Member

Modifies a Parser such that all variables act as if they were defined
using keep. The past-tense naming was chosen to match the similar
function prefixed.

By default, read variables are removed from the environment. This is
often problematic (e.g. in tests that repeatedly load an app and re-read
the environment), and the security benefits are minor. Doing this
variable by variable is error-prone and often outside of the control of
where it matters (e.g. parser defined in this library, ultimately used
in some app). This function will make it easy for the app to decide at
parse time if it wants all variables kept all the time.

Modifies a `Parser` such that all variables act as if they were defined
using `keep`. The past-tense naming was chosen to match the similar
function `prefixed`.

By default, read variables are removed from the environment. This is
often problematic (e.g. in tests that repeatedly load an app and re-read
the environment), and the security benefits are minor. Doing this
variable by variable is error-prone and often outside of the control of
where it matters (e.g. parser defined in this library, ultimately used
in some app). This function will make it easy for the app to decide at
parse time if it wants all variables kept all the time.
@pbrisbin pbrisbin requested review from a team and eborden and removed request for a team June 13, 2022 13:54
I chose to use kept at parse-time instead of keep at variable-definition
time, so that end-users could still use the variable Parsers without
keep when necessary.
@pbrisbin pbrisbin requested review from mjgpy3 and removed request for eborden June 13, 2022 16:46
@pbrisbin
Copy link
Member Author

NOTE: envparse-0.5.0 just released, which makes this unnecessary (they flipped the default behavior), but I think I'd still like to ship this to avoid bringing in the updated extra-dep ahead of time.

Copy link
Contributor

@mjgpy3 mjgpy3 left a comment

Choose a reason for hiding this comment

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

LGTM, take or leave the doc comment.

Comment on lines +10 to +11
If you would prefer not to keep these variables, parse them yourself (e.g.
with `envParseDatabaseConf`) and use `makePostgresPoolWith`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be more useful in the haddock?

Personally I look there before changelogs for usage info like this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure. To me, this behavior is only notable because it changed (hence CHANGELOG). The behavior as it was/is isn't particularly surprising to me, not worth calling out in docs at least. 🤷

@pbrisbin pbrisbin merged commit f4755af into main Jun 13, 2022
@pbrisbin pbrisbin deleted the pb/env-keep branch June 13, 2022 18:06
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.

2 participants