chrly/cmd/root.go

38 lines
719 B
Go
Raw Normal View History

package cmd
import (
"fmt"
"os"
"strings"
"github.com/elyby/chrly/bootstrap"
2018-01-24 04:09:40 +05:30
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var RootCmd = &cobra.Command{
2018-02-15 02:19:22 +05:30
Use: "chrly",
Short: "Implementation of Minecraft skins system server",
2018-01-24 04:09:40 +05:30
Version: bootstrap.GetVersion(),
}
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
2018-01-24 04:09:40 +05:30
func init() {
cobra.OnInitialize(initConfig)
}
func initConfig() {
viper.AutomaticEnv()
replacer := strings.NewReplacer(".", "_")
viper.SetEnvKeyReplacer(replacer)
}