Documentation
¶
Overview ¶
Package config provides commands for a CLI config management.
Index ¶
- func AddEnvironmentToConfig(c *cli.Context, cfg *CLIConfig, environmentID string) error
- func BuildFileName(dirname string) string
- func CommandList() []*cli.Command
- func GetDirname() (string, error)
- func GetFilename() (string, error)
- func SaveConfig(filename string, cfg *CLIConfig) error
- type CLIConfig
- type Duration
- func (d *Duration) Duration() time.Duration
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d Duration) MarshalYAML() (interface{}, error)
- func (d Duration) String() string
- func (d *Duration) UnmarshalJSON(b []byte) error
- func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Environment
- type Forwarding
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddEnvironmentToConfig ¶
AddEnvironmentToConfig adds a new environment to CLIConfig.
func BuildFileName ¶
BuildFileName builds a config filename.
func CommandList ¶
func CommandList() []*cli.Command
CommandList returns available commands for a CLI config management.
func GetDirname ¶
GetDirname returns the CLI config path located in the current user's home directory.
func GetFilename ¶
GetFilename returns the CLI config filename located in the current user's home directory.
func SaveConfig ¶
SaveConfig persists a CLI config.
Types ¶
type CLIConfig ¶
type CLIConfig struct {
CurrentEnvironment string `yaml:"current_environment" json:"current_environment"`
Environments map[string]Environment `yaml:"environments" json:"environments"`
}
CLIConfig defines a format of CLI configuration.
type Duration ¶
Duration defines a custom duration type.
func (Duration) MarshalJSON ¶
MarshalJSON marshals json duration.
func (Duration) MarshalYAML ¶
MarshalYAML marshals yaml duration.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON un-marshals json duration.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML marshals yaml duration.
type Environment ¶
type Environment struct {
EnvironmentID string `yaml:"-" json:"environment_id"`
URL string `yaml:"url" json:"url"`
Token string `yaml:"token" json:"token"`
Insecure bool `yaml:"insecure" json:"insecure"`
RequestTimeout Duration `yaml:"request_timeout,omitempty" json:"request_timeout,omitempty"`
Forwarding Forwarding `yaml:"forwarding" json:"forwarding"`
}
Environment defines a format of environment configuration.
type Forwarding ¶
type Forwarding struct {
ServerURL string `yaml:"server_url" json:"server_url"`
LocalPort string `yaml:"local_port" json:"local_port"`
IdentityFile string `yaml:"identity_file" json:"identity_file"`
}
Forwarding defines configuration for port forwarding.