commands

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// RootCmd is the root command
	RootCmd = &cobra.Command{
		Use:   "etcdauthstrap",
		Short: "etcd auth config tool",
		Long:  `A utility for configuring and enabling Auth on etcd v2 and v3 APIs`,
		PersistentPreRun: func(ccmd *cobra.Command, args []string) {
			if config != "" {

				absolutepath, err := filepath.Abs(config)

				if err != nil {
					log.Error("Error reading configfile path: ", err)
				}

				base := filepath.Base(absolutepath)

				path := filepath.Dir(absolutepath)

				viper.SetConfigType("toml")
				viper.SetConfigName(strings.Split(base, ".")[0])
				viper.SetConfigFile(config)
				viper.AddConfigPath(path)

				if err := viper.ReadInConfig(); err != nil {
					log.Fatal("Failed to read config file: ", err.Error())
					os.Exit(1)
				}
			}
		},

		Run: func(ccmd *cobra.Command, args []string) {
			ccmd.HelpFunc()(ccmd, args)
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL