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

Fail fast for required values #156

Closed
x80486 opened this issue Jul 29, 2023 · 2 comments
Closed

Fail fast for required values #156

x80486 opened this issue Jul 29, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request resolved

Comments

@x80486
Copy link

x80486 commented Jul 29, 2023

I'm integrating gookit/config in an existing project in order to manage the configuration. I've ran into some issues, but I've been able to workaround them in one way or another β€” I'm pretty new to Go as well 😬

What I've been able to do is to be able to interrupt the application bootstrapping when there is a missing value. For instance, consider the following configuration:

---
datasource:
  password: ${DATABASE_PASSWORD|unset}
  type: postgres
  username: ${DATABASE_USERNAME|postgres}
  url: ${DATABASE_URL|unset}

It would be great to have the behavior that Docker Compose provides to fail whenever a value for an environment variable is not present. Basically, if implemented exactly the same (bonus points!) the YAML file would be like this:

---
datasource:
  password: ${DATABASE_PASSWORD|?error}
  type: postgres
  username: ${DATABASE_USERNAME|postgres}
  url: ${DATABASE_URL|?error}
@inhere inhere added the enhancement New feature or request label Jul 31, 2023
@inhere
Copy link
Member

inhere commented Oct 7, 2023

hi @x80486 I added support for required value checking. Next version release.
e.g: ${DATABASE_URL|?error}

@inhere
Copy link
Member

inhere commented Oct 16, 2023

hi @x80486 New version released

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

No branches or pull requests

2 participants