os.Expand시 없는 변수는 그대로 리턴
This commit is contained in:
@ -116,7 +116,13 @@ func LoadConfig[T any](outptr *T) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return json.Unmarshal([]byte(os.ExpandEnv(string(configContents))), outptr)
|
return json.Unmarshal([]byte(os.Expand(string(configContents), func(in string) string {
|
||||||
|
envval := os.Getenv(in)
|
||||||
|
if len(envval) == 0 {
|
||||||
|
return "$" + in
|
||||||
|
}
|
||||||
|
return envval
|
||||||
|
})), outptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
type StorageAddr struct {
|
type StorageAddr struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user