config

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config provides commands for a CLI config management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEnvironmentToConfig

func AddEnvironmentToConfig(c *cli.Context, cfg *CLIConfig, environmentID string) error

AddEnvironmentToConfig adds a new environment to CLIConfig.

func BuildFileName

func BuildFileName(dirname string) string

BuildFileName builds a config filename.

func CommandList

func CommandList() []*cli.Command

CommandList returns available commands for a CLI config management.

func GetDirname

func GetDirname() (string, error)

GetDirname returns the CLI config path located in the current user's home directory.

func GetFilename

func GetFilename() (string, error)

GetFilename returns the CLI config filename located in the current user's home directory.

func SaveConfig

func SaveConfig(filename string, cfg *CLIConfig) error

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.

func Load

func Load(filename string) (*CLIConfig, error)

Load loads a CLI config by a provided filename.

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"`
	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.

Jump to

Keyboard shortcuts

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