config

package
v0.0.0-...-966d904 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VERSION is the current cli version
	VERSION = "4.2.3"
	// Beta determines whether or not this is a beta build of the CLI
	Beta = false
	// AccountsHost is the production accounts URL
	AccountsHost = "https://product.datica.com"
	// AuthHost is the production auth URL
	AuthHost = "https://auth.catalyze.io"
	// AuthHostVersion is the version path for the auth host
	AuthHostVersion = ""
	// PaasHost is the production PaaS URL
	PaasHost = "https://paas-api.catalyze.io"
	// PaasHostVersion is the version path for the PaaS host
	PaasHostVersion = ""
	// LogLevel is the amount of logging to enable
	LogLevel = logrus.InfoLevel
	// JobPollTime is the amount of time in seconds to wait between polls for a job status
	JobPollTime = 5
	// LogPollTime is the amount of time in seconds to wait between polls for new logs
	LogPollTime = 3

	// AccountsHostEnvVar is the env variable used to override AccountsHost
	AccountsHostEnvVar = "ACCOUNTS_HOST"
	// AuthHostEnvVar is the env variable used to override AuthHost
	AuthHostEnvVar = "AUTH_HOST"
	// PaasHostEnvVar is the env variable used to override PaasHost
	PaasHostEnvVar = "PAAS_HOST"
	// AuthHostVersionEnvVar is the env variable used to override AuthHostVersion
	AuthHostVersionEnvVar = "AUTH_HOST_VERSION"
	// PaasHostVersionEnvVar is the env variable used to override PaasHostVersion
	PaasHostVersionEnvVar = "PAAS_HOST_VERSION"
	// DaticaEmailEnvVar is the env variable used to override the email
	DaticaEmailEnvVar = "DATICA_EMAIL"
	// DaticaPasswordEnvVar is the env variable used to override the passowrd
	DaticaPasswordEnvVar = "DATICA_PASSWORD"
	// DaticaEnvironmentEnvVar is the env variable used to override the environment used in the current command
	DaticaEnvironmentEnvVar = "DATICA_ENV"
	// LogLevelEnvVar is the env variable used to override the logging level used
	LogLevelEnvVar = "DATICA_LOG_LEVEL"
	// SkipVerifyEnvVar is the env variable used to accept invalid SSL certificates
	SkipVerifyEnvVar = "SKIP_VERIFY"
	// DaticaConfigFile points the CLI at a .datica file
	DaticaConfigFile = "DATICA_CONFIG_FILE"

	// DaticaUsernameEnvVarDeprecated is the deprecated env variable used to override the username
	DaticaUsernameEnvVarDeprecated = "DATICA_USERNAME"

	// InvalidChars is a string containing all invalid characters for naming
	InvalidChars = "/?%"
)
View Source
const (
	OldSettingsFile = ".catalyze"
)

Variables

View Source
var SettingsFile = resolveSettingsPath()

Functions

func ArchString

func ArchString() string

ArchString translates the current architecture into an easier to read value. amd64 becomes 64-bit, 386 becomes 32-bit, etc.

func CheckRequiredAssociation

func CheckRequiredAssociation(settings *models.Settings) error

CheckRequiredAssociation ensures if an association is required for a command to run, that an appropriate environment has been picked and values assigned to the given settings object before a command is run. This is intended to be called before every command.

func SaveSettings

func SaveSettings(settings *models.Settings) error

SaveSettings persists the settings to disk

func SetGivenEnv

func SetGivenEnv(envMatch string, settings *models.Settings)

SetGivenEnv takes the given env name and finds it in the env list in the given settings object. It then populates the EnvironmentID and ServiceID on the settings object with appropriate values.

func StoreEnvironments

func StoreEnvironments(envs *[]models.Environment, settings *models.Settings)

Types

type FileSettingsRetriever

type FileSettingsRetriever struct{}

FileSettingsRetriever reads in data from the SettingsFile and generates a settings object.

func (FileSettingsRetriever) GetSettings

func (s FileSettingsRetriever) GetSettings(envName, svcName, accountsHost, authHost, ignoreAuthHostVersion, paasHost, ignorePaasHostVersion, email, password string) (*models.Settings, error)

GetSettings returns a Settings object for the current context

type SettingsRetriever

type SettingsRetriever interface {
	GetSettings(string, string, string, string, string, string, string, string, string) (*models.Settings, error)
}

SettingsRetriever defines an interface for a class responsible for generating a settings object used for most commands in the CLI. Some examples might be for retrieving settings based on the settings file or generating a settings object based on a directly entered environment ID and service ID.

Jump to

Keyboard shortcuts

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