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

Support default env prefix #191

Closed
vipcxj opened this issue Jun 11, 2024 · 0 comments · Fixed by gookit/goutil#178
Closed

Support default env prefix #191

vipcxj opened this issue Jun 11, 2024 · 0 comments · Fixed by gookit/goutil#178
Labels
enhancement New feature or request

Comments

@vipcxj
Copy link
Contributor

vipcxj commented Jun 11, 2024

For example:

	type Child struct {
		Name string `default:"${ NAME | child-name }"`
	}
	type App struct {
		Name   string `default:"${ APP_NAME | my-app }"`
		Env    string `default:"${ APP_ENV | dev}"`
		Debug  bool   `default:"${ APP_DEBUG | false}"`
		Child1 Child  `default:""`
		Child2 Child  `default:"" defaultenvprefix:"APP_CHILD_"`
	}

App.Child1 will use env NAME as its default value, and App.Child2 will use APP_CHILD_NAME as its default value.
This feature completely decouples the Child from the App.
I will make a pr for it.

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

Successfully merging a pull request may close this issue.

2 participants