cmd_helper

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPreRunHooks

func DefaultPreRunHooks(hook PreRunHookFun, defaults ...PreRunHookFun) func(*cobra.Command, []string)

func Done

func Done() <-chan os.Signal

func GetEndpoint

func GetEndpoint(typ, host, listen string) string

func GetFromStage

func GetFromStage(vs ...*viper.Viper) *viper.Viper

func GetStageFromEnv

func GetStageFromEnv(vs ...*viper.Viper) string

func GetTokenFromEnv added in v1.1.4

func GetTokenFromEnv(vs ...*viper.Viper) string

func InitServiceConfigOptions

func InitServiceConfigOptions(dst, src *ServiceConfigOptions)

func LoadConfigFile

func LoadConfigFile(opt cmd_contrib.ConfigOptioner, v *viper.Viper) func()

func PreRunHooks

func PreRunHooks(hooks ...PreRunHookFun) func(*cobra.Command, []string)

func Run

func Run(service string, fn func() error) func(cmd *cobra.Command, args []string)

func RunWithArgs

func RunWithArgs(service string, fn func(args []string) error) func(cmd *cobra.Command, args []string)

func SetDefaultHooks

func SetDefaultHooks(hooks ...PreRunHookFun)

func UnmarshalConfig

func UnmarshalConfig(dst interface{}, vs ...*viper.Viper)

Types

type ApplicationCredentialOption

type ApplicationCredentialOption struct {
	Id     string
	Secret string
}

type EndpointOption

type EndpointOption struct {
	Type string
	Host string
}

type LogOption

type LogOption struct {
	Level string
}

type PreRunHookFun

type PreRunHookFun func()

type RootOptions

type RootOptions struct {
	Config                string
	Stage                 string
	Verbose               bool
	Log                   LogOption
	ApplicationCredential ApplicationCredentialOption `mapstructure:"application_credential"`
	ServiceConfig         ServiceConfigOptions        `mapstructure:"service_config"`
}

type ServiceConfigOption

type ServiceConfigOption struct {
	Address string
}

type ServiceConfigOptions

type ServiceConfigOptions struct {
	CoreAgentd  ServiceConfigOption `mapstructure:"core_agentd"`
	Cored       ServiceConfigOption
	Identityd   ServiceConfigOption
	Camerad     ServiceConfigOption
	Sensord     ServiceConfigOption
	Streamd     ServiceConfigOption
	Metathingsd ServiceConfigOption
}

type StorageOption

type StorageOption struct {
	Driver string
	Uri    string
}

type TokenOption

type TokenOption struct {
	Token string
}

Jump to

Keyboard shortcuts

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