config

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultFile

func DefaultFile(name string) string

func ReadConfig

func ReadConfig(configFile, account string) error

Types

type Account

type Account struct {
	Flexera      *bool
	Host         string
	ID           int
	RefreshToken string `mapstructure:"refresh_token" yaml:"refresh_token"`
}

func (*Account) AppHostAndIsFlexera added in v1.3.0

func (a *Account) AppHostAndIsFlexera() (string, bool)

func (*Account) AuthHost

func (a *Account) AuthHost() string

func (*Account) Validate

func (a *Account) Validate() error

type ConfigViper

type ConfigViper struct {
	*viper.Viper
	Account  *Account
	Accounts map[string]*Account
}
var (
	Config ConfigViper
)

func (*ConfigViper) GetAccount

func (config *ConfigViper) GetAccount(id int, host string) (*Account, error)

func (*ConfigViper) SetAccount

func (config *ConfigViper) SetAccount(name string, setDefault bool, input io.Reader, output io.Writer) error

Obtain input via STDIN then print out to config file Example of config file login:

default_account: acct1
accounts:
  acct1:
    id: 67972
    host: us-3.rightscale.com
    refresh_token: abc123abc123abc123abc123abc123abc123abc1
  acct2:
    id: 60073
    host: us-4.rightscale.com
    refresh_token: zxy987zxy987zxy987zxy987xzy987zxy987xzy9

func (*ConfigViper) ShowConfiguration

func (config *ConfigViper) ShowConfiguration(output io.Writer) error

Jump to

Keyboard shortcuts

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