2017-06-30 18:40:25 +03:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
2018-02-15 14:20:17 +03:00
|
|
|
"strings"
|
2017-06-30 18:40:25 +03:00
|
|
|
|
2018-02-16 00:13:57 +03:00
|
|
|
"github.com/elyby/chrly/bootstrap"
|
2018-01-24 01:39:40 +03:00
|
|
|
|
2017-06-30 18:40:25 +03:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
|
|
|
var RootCmd = &cobra.Command{
|
2018-02-14 23:49:22 +03:00
|
|
|
Use: "chrly",
|
|
|
|
Short: "Implementation of Minecraft skins system server",
|
2018-01-24 01:39:40 +03:00
|
|
|
Version: bootstrap.GetVersion(),
|
2017-06-30 18:40:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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 01:39:40 +03:00
|
|
|
func init() {
|
2017-06-30 18:40:25 +03:00
|
|
|
cobra.OnInitialize(initConfig)
|
|
|
|
}
|
|
|
|
|
|
|
|
func initConfig() {
|
2017-08-15 00:43:31 +03:00
|
|
|
viper.AutomaticEnv()
|
2018-02-15 14:20:17 +03:00
|
|
|
replacer := strings.NewReplacer(".", "_")
|
|
|
|
viper.SetEnvKeyReplacer(replacer)
|
2017-06-30 18:40:25 +03:00
|
|
|
}
|