config

package
v0.49.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RELIABLY_HOST  = envReliablyHost
	RELIABLY_ORG   = envReliablyOrg
	RELIABLY_TOKEN = envReliablyToken
	DEBUG          = envDebug
)

Variables

View Source
var (
	// The directory where the application config can be found
	ConfigDir = "~/.config/reliably"

	// The file that contains application config
	ConfigFile = ConfigDir + "/config.yaml"

	// The hostname of the reliably web services
	Hostname = "app.reliably.com"

	// The Entity Server hostname. This may be merged in to the Hostame variable later.
	EntityServerHost = Hostname

	// The organization info matching the RELIABLY_ORG ID/username used
	OverriddenOrg *OrgInfo
)

Functions

func AuthTokenProvidedFromEnv added in v0.18.1

func AuthTokenProvidedFromEnv() bool

func DeleteAuthInfoForHostname

func DeleteAuthInfoForHostname(hostname string) error

func GetKnownHosts

func GetKnownHosts() ([]string, error)

GetKnownHosts returns the list of hostnames defined in the config auths block If Token is provided by the env var, we use the overiddable host if not found in the config

func GetTokenFor

func GetTokenFor(hostname string) string

func GetUsernameFor

func GetUsernameFor(hostname string) string

func IsDebugMode

func IsDebugMode() bool

func SetAuthInfo

func SetAuthInfo(hostname string, data AuthInfo) error

func SetCurrentOrgInfo

func SetCurrentOrgInfo(name, ID string) error

func SetTokenForHostname

func SetTokenForHostname(hostname, token string) error

func SetUsernameForHostname

func SetUsernameForHostname(hostname, username string) error

Types

type AuthInfo

type AuthInfo struct {
	Token    string `yaml:"token"`
	Username string `yaml:"username"`
}

type Config

type Config struct {
	AuthInfo   map[string]AuthInfo `yaml:"auths"`
	CurrentOrg OrgInfo             `yaml:"currentOrg"`
}

func NewConfig added in v0.18.1

func NewConfig() *Config

NewConfig initializes a config with empty/default values

type OrgInfo

type OrgInfo struct {
	Name string `yaml:"name"`
	ID   string `yaml:"id"`
}

func GetCurrentOrgInfo

func GetCurrentOrgInfo() (*OrgInfo, error)

Jump to

Keyboard shortcuts

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