settings: new function to regenerate files

This commit is contained in:
nemunaire 2017-12-12 07:52:19 +01:00 committed by Pierre-Olivier Mercier
parent 058c2eda57
commit 0321e0d30e
1 changed files with 10 additions and 0 deletions

View File

@ -68,6 +68,16 @@ func SaveSettings(path string, s FICSettings) error {
}
}
func ForceRegeneration() error {
location := path.Join(SettingsDir, SettingsFile)
if settings, err := ReadSettings(location); err != nil {
return err
} else {
settings.Generation = time.Now()
return SaveSettings(location, settings)
}
}
func LoadAndWatchSettings(settingsPath string, reload func (FICSettings)) {
// First load of configuration if it exists
if _, err := os.Stat(settingsPath); !os.IsNotExist(err) {