Documentation ¶
Overview ¶
Package configuration is in charge of the validation and extraction of all the configuration details from environment variables.
Index ¶
- Constants
- Variables
- type Config
- func (c *Config) GetAuthClientConfigAuthContentType() string
- func (c *Config) GetAuthClientConfigAuthRaw() string
- func (c *Config) GetAuthClientLibraryURL() string
- func (c *Config) GetAuthClientPublicKeysURL() string
- func (c *Config) GetEnvironment() string
- func (c *Config) GetGracefulTimeout() time.Duration
- func (c *Config) GetHTTPAddress() string
- func (c *Config) GetHTTPCompressResponses() bool
- func (c *Config) GetHTTPIdleTimeout() time.Duration
- func (c *Config) GetHTTPReadTimeout() time.Duration
- func (c *Config) GetHTTPWriteTimeout() time.Duration
- func (c *Config) GetLogLevel() string
- func (c *Config) GetNamespace() string
- func (c *Config) GetViperInstance() *viper.Viper
- func (c *Config) IsLogJSON() bool
- func (c *Config) IsTestingMode() bool
Constants ¶
const ( // EnvPrefix will be used for environment variable name prefixing. EnvPrefix = "DEVCLUSTER" // DefaultHTTPAddress is the address and port string that your service will // be exported to by default. DefaultHTTPAddress = "0.0.0.0:8080" // DefaultHTTPIdleTimeout specifies the default timeout for HTTP idling. DefaultHTTPIdleTimeout = time.Second * 15 // DefaultHTTPCompressResponses compresses HTTP responses for clients that // support it via the 'Accept-Encoding' header. DefaultHTTPCompressResponses = true // DefaultEnvironment is the default environment DefaultEnvironment = "prod" UnitTestsEnvironment = "unit-tests" // DefaultLogLevel is the default log level used in your service. DefaultLogLevel = "info" // DefaultLogJSON is a switch to toggle on and off JSON log output. DefaultLogJSON = false // DefaultGracefulTimeout is the duration for which the server gracefully // wait for existing connections to finish - e.g. 15s or 1m. DefaultGracefulTimeout = time.Second * 15 // DefaultHTTPWriteTimeout specifies the default timeout for HTTP writes. DefaultHTTPWriteTimeout = time.Second * 15 // DefaultHTTPReadTimeout specifies the default timeout for HTTP reads. DefaultHTTPReadTimeout = time.Second * 15 // DefaultAuthClientLibraryURL is the default auth library location. DefaultAuthClientLibraryURL = "https://sso.prod-preview.openshift.io/auth/js/keycloak.js" // DefaultAuthClientConfigRaw specifies the auth client config. DefaultAuthClientConfigRaw = `` /* 222-byte string literal not displayed */ // DefaultAuthClientConfigContentType specifies the auth client config content type. DefaultAuthClientConfigContentType = "application/json; charset=utf-8" // DefaultAuthClientPublicKeysURL is the default log level used in your service. DefaultAuthClientPublicKeysURL = "https://sso.prod-preview.openshift.io/auth/realms/devcluster-public/protocol/openid-connect/certs" // DefaultNamespace is the default k8s namespace to use. DefaultNamespace = "devcluster" )
Variables ¶
var ( // Commit current build commit set by build script. Commit = "0" // BuildTime set by build script in ISO 8601 (UTC) format: // YYYY-MM-DDThh:mm:ssTZD (see https://www.w3.org/TR/NOTE-datetime for // details). BuildTime = "0" // StartTime in ISO 8601 (UTC) format. StartTime = time.Now().UTC().Format("2006-01-02T15:04:05Z") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config encapsulates the Viper configuration which stores the configuration data in-memory.
func (*Config) GetAuthClientConfigAuthContentType ¶
GetAuthClientConfigAuthContentType returns the auth config config content type (as set via config file or environment variable).
func (*Config) GetAuthClientConfigAuthRaw ¶
GetAuthClientConfigAuthRaw returns the auth config config (as set via config file or environment variable).
func (*Config) GetAuthClientLibraryURL ¶
GetAuthClientLibraryURL returns the auth library location (as set via config file or environment variable).
func (*Config) GetAuthClientPublicKeysURL ¶
GetAuthClientPublicKeysURL returns the public keys URL (as set via config file or environment variable).
func (*Config) GetEnvironment ¶
GetEnvironment returns the environment such as prod, stage, unit-tests, e2e-tests, dev, etc
func (*Config) GetGracefulTimeout ¶
GetGracefulTimeout returns the duration for which the server gracefully wait for existing connections to finish - e.g. 15s or 1m.
func (*Config) GetHTTPAddress ¶
GetHTTPAddress returns the HTTP address (as set via default, config file, or environment variable) that the app-server binds to (e.g. "0.0.0.0:8080").
func (*Config) GetHTTPCompressResponses ¶
GetHTTPCompressResponses returns true if HTTP responses should be compressed for clients that support it via the 'Accept-Encoding' header.
func (*Config) GetHTTPIdleTimeout ¶
GetHTTPIdleTimeout returns the duration for the idle timeout.
func (*Config) GetHTTPReadTimeout ¶
GetHTTPReadTimeout returns the duration for the read timeout.
func (*Config) GetHTTPWriteTimeout ¶
GetHTTPWriteTimeout returns the duration for the write timeout.
func (*Config) GetLogLevel ¶
GetLogLevel returns the logging level (as set via config file or environment variable).
func (*Config) GetNamespace ¶
GetNamespace returns the namespace in which the registration service and host operator is running
func (*Config) GetViperInstance ¶
GetViperInstance returns the underlying Viper instance.
func (*Config) IsLogJSON ¶
IsLogJSON returns if we should log json format (as set via config file or environment variable).
func (*Config) IsTestingMode ¶
IsTestingMode returns if the service runs in unit-tests environment