feat: Support multiple configuration files (#389)
* Allow configuration to be distributed * catch iteration errors when collecting config files * rm unused func * Fix suffix check for config loading * test configuration loading * GATUS_CONFIG_PATH can be a file or a directory now * Add deprecation note * Fix cs Co-authored-by: TwiN <twin@linux.com> * cs fixes Co-authored-by: TwiN <twin@linux.com> * cs fixes Co-authored-by: TwiN <twin@linux.com> * cs fixes Co-authored-by: TwiN <twin@linux.com> * cs + rm useless line Co-authored-by: TwiN <twin@linux.com> * Update config/config.go Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
14
main.go
14
main.go
@ -52,14 +52,14 @@ func save() {
|
||||
}
|
||||
}
|
||||
|
||||
func loadConfiguration() (cfg *config.Config, err error) {
|
||||
customConfigFile := os.Getenv("GATUS_CONFIG_FILE")
|
||||
if len(customConfigFile) > 0 {
|
||||
cfg, err = config.Load(customConfigFile)
|
||||
} else {
|
||||
cfg, err = config.LoadDefaultConfiguration()
|
||||
func loadConfiguration() (*config.Config, error) {
|
||||
var configPath = os.Getenv("GATUS_CONFIG_PATH")
|
||||
// Backwards compatibility
|
||||
if len(configPath) == 0 {
|
||||
configPath = os.Getenv("GATUS_CONFIG_FILE")
|
||||
}
|
||||
return
|
||||
|
||||
return config.LoadConfiguration(configPath)
|
||||
}
|
||||
|
||||
// initializeStorage initializes the storage provider
|
||||
|
Reference in New Issue
Block a user