super-graph/serv/cmd_conf.go

29 lines
478 B
Go
Raw Permalink Normal View History

package serv
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
func cmdConfDump(cmd *cobra.Command, args []string) {
if len(args) != 1 {
cmd.Help()
os.Exit(1)
}
fname := fmt.Sprintf("%s.%s", getConfigName(), args[0])
conf, err := initConf()
if err != nil {
2019-11-25 08:22:33 +01:00
errlog.Fatal().Err(err).Msg("failed to read config")
}
if err := conf.Viper.WriteConfigAs(fname); err != nil {
2019-11-25 08:22:33 +01:00
errlog.Fatal().Err(err).Send()
}
logger.Info().Msgf("config dumped to ./%s", fname)
}