mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-07 08:34:15 +01:00
Add GATUS_DONT_EXPAND_ENV env var
This commit is contained in:
parent
b59ff6f89e
commit
3be6d04d29
@ -38,6 +38,8 @@ var (
|
||||
|
||||
// ErrInvalidSecurityConfig is an error returned when the security configuration is invalid
|
||||
ErrInvalidSecurityConfig = errors.New("invalid security configuration")
|
||||
|
||||
dontExpandEnv = os.Getenv("GATUS_DONT_EXPAND_ENV") == "true"
|
||||
)
|
||||
|
||||
// Config is the main configuration structure
|
||||
@ -152,7 +154,9 @@ func readConfigurationFile(fileName string) (config *Config, err error) {
|
||||
// parseAndValidateConfigBytes parses a Gatus configuration file into a Config struct and validates its parameters
|
||||
func parseAndValidateConfigBytes(yamlBytes []byte) (config *Config, err error) {
|
||||
// Expand environment variables
|
||||
yamlBytes = []byte(os.ExpandEnv(string(yamlBytes)))
|
||||
if !dontExpandEnv {
|
||||
yamlBytes = []byte(os.ExpandEnv(string(yamlBytes)))
|
||||
}
|
||||
// Parse configuration file
|
||||
if err = yaml.Unmarshal(yamlBytes, &config); err != nil {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user