write commented json default config

This commit is contained in:
André Roth
2024-12-01 10:51:58 +01:00
parent 622072bd50
commit ea80f6d49c
8 changed files with 421 additions and 53 deletions

View File

@@ -215,6 +215,18 @@ func SaveConfig(filename string, config *ConfigStructure) error {
return err
}
// SaveConfigRaw write configuration to file
func SaveConfigRaw(filename string, conf []byte) error {
f, err := os.Create(filename)
if err != nil {
return err
}
defer f.Close()
_, err = f.Write(conf)
return err
}
// GetRootDir returns the RootDir with expanded ~ as home directory
func (conf *ConfigStructure) GetRootDir() string {
return strings.Replace(conf.RootDir, "~", os.Getenv("HOME"), 1)