summaryrefslogtreecommitdiff
path: root/cmd/gotosocial/action/debug/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/gotosocial/action/debug/config/config.go')
-rw-r--r--cmd/gotosocial/action/debug/config/config.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/cmd/gotosocial/action/debug/config/config.go b/cmd/gotosocial/action/debug/config/config.go
index 92f18bdfd..010907eab 100644
--- a/cmd/gotosocial/action/debug/config/config.go
+++ b/cmd/gotosocial/action/debug/config/config.go
@@ -23,17 +23,29 @@ import (
"encoding/json"
"fmt"
- "github.com/spf13/viper"
"github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action"
+ "github.com/superseriousbusiness/gotosocial/internal/config"
)
// Config just prints the collated config out to stdout as json.
-var Config action.GTSAction = func(ctx context.Context) error {
- allSettings := viper.AllSettings()
- b, err := json.Marshal(&allSettings)
+var Config action.GTSAction = func(ctx context.Context) (err error) {
+ var raw map[string]interface{}
+
+ // Marshal configuration to a raw JSON map
+ config.Config(func(cfg *config.Configuration) {
+ raw, err = cfg.MarshalMap()
+ })
+ if err != nil {
+ return err
+ }
+
+ // Marshal map to JSON
+ b, err := json.Marshal(raw)
if err != nil {
return err
}
- fmt.Println(string(b))
+
+ // Print to stdout
+ fmt.Printf("%s\n", b)
return nil
}