Set property K for int type + write config to disk

This commit is contained in:
yo
2022-04-02 21:38:54 +02:00
parent f40db69b9d
commit da74456d6a
3 changed files with 57 additions and 122 deletions

View File

@ -12,7 +12,7 @@ import (
)
const (
gVersion = "0.022b"
gVersion = "0.023"
)
var (
@ -188,12 +188,16 @@ func cleanAfterRun() {
for _, j := range gJails {
if j.ConfigUpdated {
// TODO : Marshall to disk
fmt.Printf("Config for jail %s will be updated\n", j.Name)
//fmt.Printf("Config for jail %s will be updated\n", j.Name)
marshaled, err := json.MarshalIndent(j.Config, "", " ")
if err != nil {
fmt.Printf("ERROR marshaling config: %s\n", err.Error())
}
fmt.Printf(string(marshaled))
//fmt.Printf(string(marshaled))
if os.WriteFile(j.ConfigPath, []byte(marshaled), 0644); err != nil {
fmt.Printf("Error writing config file %s: %v\n", j.ConfigPath, err)
os.Exit(1)
}
}
}
}