aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/config/config.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index b31399713..fc77d2496 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -32,6 +32,14 @@ func LoadData(data []byte, cfg interface{}) error {
return nil
}
+func SaveFile(filename string, cfg interface{}) error {
+ data, err := json.MarshalIndent(cfg, "", "\t")
+ if err != nil {
+ return err
+ }
+ return ioutil.WriteFile(filename, data, 0600)
+}
+
func checkUnknownFields(data []byte, typ reflect.Type) error {
if typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct {
return fmt.Errorf("config type is not pointer to struct")