[MM-14400] Programmatically generate default.json (#10551)
* create/update config.json using go generate * added default config generator added config-reset to Jenkins and make package, updated defaults to consider 'isNew' flag * corrections after code review * fixed Config.isValid to handle empty encryption keys * fixed Config.isValid to handle empty encryption keys * fixed Config.isValid to handle empty encryption keys * isUpdate now only checks for nil * Addressed review comments, added unit testing for default config generator * err shadowing * license * provide output file for config generator via ENV variable, since go generate doesn't support arguments and we need two output paths (config-reset and package) * cleanup * proper defaults for PushNotificationServer and SendPushNotifications * corrected generating defaults for TrustedProxyIPHeader to be consistent with default.json in master * Check for empty SiteURL as well as nil * corrected SiteURL settings and checking * crazy typos fixed * corrected tests to newly expected values * relaxed the checks * fixed formatting
Этот коммит содержится в:
коммит произвёл
Jesse Hallam
родитель
978ee13262
Коммит
6a42ad2af5
@@ -141,16 +141,10 @@ func setupConfig(configDir string) error {
|
||||
return errors.Wrapf(err, "failed to create config directory %s", configDir)
|
||||
}
|
||||
|
||||
defaultJson := path.Join(configDir, "default.json")
|
||||
err = ioutil.WriteFile(defaultJson, []byte(config.ToJson()), 0644)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to write config to %s", defaultJson)
|
||||
}
|
||||
|
||||
configJson := path.Join(configDir, "config.json")
|
||||
err = utils.CopyFile(defaultJson, configJson)
|
||||
err = ioutil.WriteFile(configJson, []byte(config.ToJson()), 0644)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to copy file %s to %s", defaultJson, configJson)
|
||||
return errors.Wrapf(err, "failed to write config to %s", configJson)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Ссылка в новой задаче
Block a user