Fix: conf for security, dont show

pull/21/head
zijiren233 2 years ago
parent 0a3a7b11b5
commit 7b709f55a9

@ -1,17 +1,15 @@
package cmd package cmd
import ( import (
"fmt" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/synctv-org/synctv/internal/bootstrap" "github.com/synctv-org/synctv/internal/bootstrap"
"github.com/synctv-org/synctv/internal/conf"
) )
var ConfCmd = &cobra.Command{ var ConfCmd = &cobra.Command{
Use: "conf", Use: "conf",
Short: "conf", Short: "init or check",
Long: `config file`, Long: `Init or check config file for correctness`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error { PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitConfig, bootstrap.InitConfig,
@ -21,7 +19,7 @@ var ConfCmd = &cobra.Command{
} }
func Conf(cmd *cobra.Command, args []string) error { func Conf(cmd *cobra.Command, args []string) error {
fmt.Println(conf.Conf.String()) logrus.Infof("success")
return nil return nil
} }

@ -2,8 +2,6 @@ package conf
import ( import (
"github.com/synctv-org/synctv/utils" "github.com/synctv-org/synctv/utils"
"github.com/zijiren233/stream"
"gopkg.in/yaml.v3"
) )
type Config struct { type Config struct {
@ -30,11 +28,6 @@ func (c *Config) Save(file string) error {
return utils.WriteYaml(file, c) return utils.WriteYaml(file, c)
} }
func (c *Config) String() string {
o, _ := yaml.Marshal(c)
return stream.BytesToString(o)
}
func DefaultConfig() *Config { func DefaultConfig() *Config {
return &Config{ return &Config{
// Log // Log

Loading…
Cancel
Save