configuration

package
v0.0.0-...-9b56418 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 18 Imported by: 5

Documentation

Overview

Package configuration is in charge of the validation and extraction of all the configuration details from a configuration file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathExists

func PathExists(pathToCheck string) (string, error)

PathExists returns existed path or error if path doesn't exist

Types

type ConfigurationData

type ConfigurationData struct {
	// contains filtered or unexported fields
}

ConfigurationData encapsulates the Viper configuration object which stores the configuration data in-memory.

func GetConfigurationData

func GetConfigurationData() (*ConfigurationData, error)

GetConfigurationData is a wrapper over NewConfigurationData which reads configuration file path from the environment variable.

func NewConfigurationData

func NewConfigurationData(mainConfigFile string, clusterConfigFile string) (*ConfigurationData, error)

NewConfigurationData creates a configuration reader object using configurable configuration file paths

func (*ConfigurationData) DefaultConfigurationError

func (c *ConfigurationData) DefaultConfigurationError() error

DefaultConfigurationError returns an error if the default values is used for sensitive configuration like service account secrets or private keys. Error contains all the details. Returns nil if the default configuration is not used.

func (*ConfigurationData) DeveloperModeEnabled

func (c *ConfigurationData) DeveloperModeEnabled() bool

DeveloperModeEnabled returns if development related features (as set via default, config file, or environment variable), e.g. token generation endpoint are enabled

func (*ConfigurationData) GetAuthKeysPath

func (c *ConfigurationData) GetAuthKeysPath() string

GetAuthKeysPath returns the path to auth keys endpoint

func (*ConfigurationData) GetAuthServiceURL

func (c *ConfigurationData) GetAuthServiceURL() string

GetAuthServiceURL returns Auth Service URL

func (*ConfigurationData) GetClusterByURL

func (c *ConfigurationData) GetClusterByURL(url string) *repository.Cluster

GetClusterByURL returns a cluster configurations by matching URL Regardless of trailing slashes if cluster API URL == "https://api.openshift.com" or "https://api.openshift.com/" it will match any "https://api.openshift.com*" like "https://api.openshift.com", "https://api.openshift.com/", or "https://api.openshift.com/patch" Returns nil if no matching API URL found

func (*ConfigurationData) GetClusterConfigurationFilePath

func (c *ConfigurationData) GetClusterConfigurationFilePath() string

GetClusterConfigurationFilePath returns the cluster configuration file path.

func (*ConfigurationData) GetClusterServiceURL

func (c *ConfigurationData) GetClusterServiceURL() string

GetClusterServiceURL returns Cluster Service URL

func (*ConfigurationData) GetClusters

func (c *ConfigurationData) GetClusters() map[string]repository.Cluster

GetClusters returns a map of cluster configurations by cluster API URL

func (*ConfigurationData) GetDefaultConfigurationFile

func (c *ConfigurationData) GetDefaultConfigurationFile() string

GetDefaultConfigurationFile returns the default configuration file.

func (*ConfigurationData) GetDevModePrivateKey

func (c *ConfigurationData) GetDevModePrivateKey() []byte

GetDevModePrivateKey returns the private key and its ID used in tests

func (*ConfigurationData) GetEnvironment

func (c *ConfigurationData) GetEnvironment() string

GetEnvironment returns the current environment application is deployed in like 'production', 'prod-preview', 'local', etc as the value of environment variable `F8_ENVIRONMENT` is set.

func (*ConfigurationData) GetHTTPAddress

func (c *ConfigurationData) GetHTTPAddress() string

GetHTTPAddress returns the HTTP address (as set via default, config file, or environment variable) that the cluster server binds to (e.g. "0.0.0.0:8087")

func (*ConfigurationData) GetLogLevel

func (c *ConfigurationData) GetLogLevel() string

GetLogLevel returns the logging level (as set via config file or environment variable)

func (*ConfigurationData) GetMetricsHTTPAddress

func (c *ConfigurationData) GetMetricsHTTPAddress() string

GetMetricsHTTPAddress returns the address the /metrics endpoing will be mounted. By default GetMetricsHTTPAddress is the same as GetHTTPAddress

func (*ConfigurationData) GetPostgresConfigString

func (c *ConfigurationData) GetPostgresConfigString() string

GetPostgresConfigString returns a ready to use string for usage in sql.Open()

func (*ConfigurationData) GetPostgresConnectionMaxIdle

func (c *ConfigurationData) GetPostgresConnectionMaxIdle() int

GetPostgresConnectionMaxIdle returns the number of connections that should be keept alive in the database connection pool at any given time. -1 represents no restrictions/default behavior

func (*ConfigurationData) GetPostgresConnectionMaxOpen

func (c *ConfigurationData) GetPostgresConnectionMaxOpen() int

GetPostgresConnectionMaxOpen returns the max number of open connections that should be open in the database connection pool. -1 represents no restrictions/default behavior

func (*ConfigurationData) GetPostgresConnectionRetrySleep

func (c *ConfigurationData) GetPostgresConnectionRetrySleep() time.Duration

GetPostgresConnectionRetrySleep returns the number of seconds (as set via default, config file, or environment variable) to wait before trying to connect again

func (*ConfigurationData) GetPostgresConnectionTimeout

func (c *ConfigurationData) GetPostgresConnectionTimeout() int64

GetPostgresConnectionTimeout returns the postgres connection timeout as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresDatabase

func (c *ConfigurationData) GetPostgresDatabase() string

GetPostgresDatabase returns the postgres database as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresHost

func (c *ConfigurationData) GetPostgresHost() string

GetPostgresHost returns the postgres host as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresPassword

func (c *ConfigurationData) GetPostgresPassword() string

GetPostgresPassword returns the postgres password as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresPort

func (c *ConfigurationData) GetPostgresPort() int64

GetPostgresPort returns the postgres port as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresSSLMode

func (c *ConfigurationData) GetPostgresSSLMode() string

GetPostgresSSLMode returns the postgres sslmode as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresTransactionTimeout

func (c *ConfigurationData) GetPostgresTransactionTimeout() time.Duration

GetPostgresTransactionTimeout returns the number of minutes to timeout a transaction

func (*ConfigurationData) GetPostgresUser

func (c *ConfigurationData) GetPostgresUser() string

GetPostgresUser returns the postgres user as set via default, config file, or environment variable

func (*ConfigurationData) GetSentryDSN

func (c *ConfigurationData) GetSentryDSN() string

GetSentryDSN returns the secret needed to securely communicate with https://errortracking.prod-preview.openshift.io/openshift_io/fabric8-cluster/

func (*ConfigurationData) IsCleanTestDataEnabled

func (c *ConfigurationData) IsCleanTestDataEnabled() bool

IsCleanTestDataEnabled returns `true` if the test data should be cleaned after each test. (default: true)

func (*ConfigurationData) IsCleanTestDataErrorReportingRequired

func (c *ConfigurationData) IsCleanTestDataErrorReportingRequired() bool

IsCleanTestDataErrorReportingRequired returns `true` if there is any error while cleaning test data after each test. (default: true)

func (*ConfigurationData) IsDBLogsEnabled

func (c *ConfigurationData) IsDBLogsEnabled() bool

IsDBLogsEnabled returns `true` if the DB logs (ie, SQL queries) should be output in the console. (default: false)

func (*ConfigurationData) IsLogJSON

func (c *ConfigurationData) IsLogJSON() bool

IsLogJSON returns if we should log json format (as set via config file or environment variable)

func (*ConfigurationData) ReloadClusterConfig

func (c *ConfigurationData) ReloadClusterConfig() error

ReloadClusterConfig reloads the cluster from the config file

func (*ConfigurationData) String

func (c *ConfigurationData) String() string

String returns the current configuration as a string

Jump to

Keyboard shortcuts

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