config

package
v0.0.0-...-3539f02 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Profile      Profile
	ProfilesFile string
}

Config handles all overall configuration for the CLI

func (*Config) CreateProfile

func (c *Config) CreateProfile() error

func (*Config) EditConfig

func (c *Config) EditConfig() error

EditConfig opens the configuration file in the default editor.

func (*Config) GetConfigFolder

func (c *Config) GetConfigFolder(xdgPath string) string

GetConfigFolder retrieves the folder where the profiles file is stored It searches for the xdg environment path first and will secondarily place it in the home directory

func (*Config) InitConfig

func (c *Config) InitConfig()

InitConfig reads in profiles file and ENV variables if set.

func (*Config) PrintConfig

func (c *Config) PrintConfig() error

PrintConfig outputs the contents of the configuration file.

type Profile

type Profile struct {
	DeviceName        string
	ProfileName       string
	APIKey            string
	APISecret         string
	LiveModeAPIKey    string
	LiveModeAPISecret string
	TestModeAPIKey    string
	TestModeAPISecret string
	DisplayName       string
}

Profile handles all things related to managing the project specific configurations

func (*Profile) CreateProfile

func (p *Profile) CreateProfile() error

CreateProfile creates a profile when logging in

func (*Profile) DeleteConfigField

func (p *Profile) DeleteConfigField(field string) error

DeleteConfigField deletes a configuration field.

func (*Profile) GetAPIKey

func (p *Profile) GetAPIKey(livemode bool) (string, error)

GetAPIKey will return the existing key for the given profile

func (*Profile) GetAPISecret

func (p *Profile) GetAPISecret(livemode bool) (string, error)

GetAPIKey will return the existing key for the given profile

func (*Profile) GetConfigField

func (p *Profile) GetConfigField(field string) string

GetConfigField returns the configuration field for the specific profile

func (*Profile) GetDeviceName

func (p *Profile) GetDeviceName() (string, error)

GetDeviceName returns the configured device name

func (*Profile) GetDisplayName

func (p *Profile) GetDisplayName() string

GetDisplayName returns the account display name of the user

func (*Profile) RegisterAlias

func (p *Profile) RegisterAlias(alias, key string)

RegisterAlias registers an alias for a given key.

func (*Profile) WriteConfigField

func (p *Profile) WriteConfigField(field, value string) error

WriteConfigField updates a configuration field and writes the updated configuration to disk.

Jump to

Keyboard shortcuts

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