mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
22 lines
366 B
Go
22 lines
366 B
Go
package api
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func init() {
|
|
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_"))
|
|
viper.AutomaticEnv()
|
|
}
|
|
|
|
func bindFlagsToViper(cmd *cobra.Command) error {
|
|
if err := viper.BindPFlags(cmd.Flags()); err != nil {
|
|
return err
|
|
}
|
|
|
|
return viper.BindPFlags(cmd.PersistentFlags())
|
|
}
|