config

package
v0.0.0-...-3c2e68c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const CludoExecutable = "cludo"
View Source
const CludodExecutable = "cludod"
View Source
const DefaultClientConfig = "default"
View Source
const EnvPrefix = "CLUDO"

EnvPrefix defines a prefix required on all environment variables bound to Config. For example the path "number" is bound to CLUDO_NUMBER.

Variables

View Source
var ErrConfigNotFound = errors.New("Failed to load configuration file: File not found")

Functions

func ConfigureViper

func ConfigureViper(executable string, configFile string) error

func ErrConfigLoadFailed

func ErrConfigLoadFailed(cause error) error

func ErrHomeDirFailed

func ErrHomeDirFailed(cause error) error

func ErrWorkingDirFailed

func ErrWorkingDirFailed(cause error) error

func NewClient

func NewClient(target string, debug bool) (*client.Cludod, error)

Types

type AWSRoleConfig

type AWSRoleConfig struct {
	SessionDuration time.Duration `mapstructure:"session_duration"`
	AccessKeyID     string        `mapstructure:"access_key_id"`
	SecretAccessKey string        `mapstructure:"secret_access_key"`
	AssumeRoleARN   string        `mapstructure:"arn"`
	Region          string        `mapstructure:"region"`
}

func (*AWSRoleConfig) NewPlugin

func (arc *AWSRoleConfig) NewPlugin() (*aws.AWSPlugin, error)

type ClientConfig

type ClientConfig struct {
	Interactive bool   `mapstructure:"interactive"`
	ShellPath   string `mapstructure:"shell_path"`
}

func (*ClientConfig) NewDefaultClientSigner

func (cc *ClientConfig) NewDefaultClientSigner(pkey string) (*auth.Signer, error)

NewDefaultClientSigner attempts to read and decode the provided private key and then generate a signer that can be used to sign requests to the server. It returns a *auth.Signer and any errors that were encountered.

type Config

type Config struct {
	Client      *ClientConfig `mapstructure:"client"`
	Server      *ServerConfig `mapstructure:"server"`
	Target      string        `mapstructure:"target"`
	SSHKeyPaths []string      `mapstructure:"ssh_key_paths"`
}

func NewConfigFromViper

func NewConfigFromViper() (*Config, error)

type GithubConfig

type GithubConfig struct {
	APIEndpoint string `mapstructure:"api_endpoint"`
}

type ServerConfig

type ServerConfig struct {
	Port    int                         `yaml:"port"`
	Targets map[string]*UserRolesConfig `mapstructure:"targets"`

	Github *GithubConfig `mapstructure:"github"`
	Users  []*UserConfig `mapstructure:"users"`
}

func (*ServerConfig) GetUser

func (sc *ServerConfig) GetUser(id string) (*UserConfig, bool)

func (*ServerConfig) NewConfigAuthorizer

func (sc *ServerConfig) NewConfigAuthorizer() (*auth.Authorizer, error)

func (*ServerConfig) NewGithubAuthorizer

func (sc *ServerConfig) NewGithubAuthorizer() (*auth.Authorizer, error)

type UserConfig

type UserConfig struct {
	PublicKey string   `mapstructure:"public_key"`
	Name      string   `mapstructure:"name"`
	GithubID  string   `mapstructure:"github_id"`
	Targets   []string `mapstructure:"targets"`
}

func (*UserConfig) ID

func (uc *UserConfig) ID() string

type UserRolesConfig

type UserRolesConfig struct {
	AWS *AWSRoleConfig `mapstructure:"aws"`
}

Jump to

Keyboard shortcuts

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