add config app

This commit is contained in:
shoopea
2025-10-07 20:56:21 +02:00
parent fd02cfdfc3
commit 3c7838b10a
4 changed files with 46 additions and 4 deletions

View File

@@ -206,6 +206,23 @@ func (c *Config) Pretty() ([]byte, error) {
return pretty.PrettyOptions(b, &pretty.Options{Indent: " "}), nil
}
// Pretty App Config
func (a *AppConfig) Pretty() ([]byte, error) {
log.WithFields(log.Fields{}).Debugf("starting")
defer log.WithFields(log.Fields{}).Debugf("done")
cfgMx.Lock()
defer cfgMx.Unlock()
b, err := json.Marshal(a)
if err != nil {
log.WithFields(log.Fields{"error": err, "call": "json.Marshal"}).Errorf("")
return nil, err
}
return pretty.PrettyOptions(b, &pretty.Options{Indent: " "}), nil
}
// Save config
func (c *Config) Save() error {
log.WithFields(log.Fields{}).Debugf("starting")