You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Struct tags such as envDefault are used to specify default values for fields. These values are automatically applied if the corresponding environment variable is not set.
Example
type Config struct {
Name string `env:"MY_NAME" validate:"required"`
Team string `env:"MY_TEAM" envDefault:"Backend"`
Username string `env:"MY_USERNAME" secret:"true" validate:"required"`
Password string `env:"MY_PASSWORD" secret:"true" validate:"required"`
}
@coderx31 Thanks for pointing it out. Then we only have to update the documentation and the examples. Users should be aware about these features and we can utilize this issue to track the documentation update.
Currently users cannot set default values for env configs. if would be nice if users can add a default values to the configs.
Example
The text was updated successfully, but these errors were encountered: