Fail fast for required values
x80486 opened this issue · comments
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}