⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

fix: prevent crash over missing some env vars#157

Open
ivinjabraham wants to merge 1 commit intodevelopfrom
default-env
Open

fix: prevent crash over missing some env vars#157
ivinjabraham wants to merge 1 commit intodevelopfrom
default-env

Conversation

@ivinjabraham
Copy link
Member

Environment variables like "ROOT_SECRET" and "ROOT_PORT" can have sensible defaults and does not need to nag the user to set them in order to start. Provide default values in case they are not found in env.

Additionally, the default provided for ROOT_ENV is passed in through unwrap_or_else, but this extra lazy evaluation isn't optimizing much and only hinders readability. Change this to unwrap_or as simple strings are not compute heavy enough to warrant the lazy eval.

Environment variables like "ROOT_SECRET" and "ROOT_PORT" can have
sensible defaults and does not need to nag the user to set them in order
to start. Provide default values in case they are not found in env.

Additionally, the default provided for ROOT_ENV is passed in through
`unwrap_or_else`, but this extra lazy evaluation isn't optimizing much
and only hinders readability. Change this to `unwrap_or` as simple
strings are not compute heavy enough to warrant the lazy eval.

Signed-off-by: Ivin Joel Abraham <ivinjoelabraham@proton.me>
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.

1 participant