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

expand from default values #279

Closed
kriptor opened this issue Sep 4, 2023 · 1 comment · Fixed by #285
Closed

expand from default values #279

kriptor opened this issue Sep 4, 2023 · 1 comment · Fixed by #285

Comments

@kriptor
Copy link

kriptor commented Sep 4, 2023

Hi,

for example, if you have the following struct

type config struct {
	Home       string   `env:"MY_HOME"            envDefault:"/tmp"`
	TempFolder string   `env:"TEMP_FOLDER,expand" envDefault:"${MY_HOME}/temp"`
}

and there are no environment variables when you start the process. It would still be nice if you had an option to get Home: "/tmp" and TempFolder: "/tmp/temp", wouldn't it? I mean, we did specify what the defaults are :)

If expand shouldn't be used like that, maybe expandWithDefaults could be.

Cheers!

@caarlos0
Copy link
Owner

caarlos0 commented Sep 5, 2023

happy to review a PR for that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants