configuration

package
v0.0.0-...-e35233a Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package configuration is in charge of the validation and extraction of all the configuration details from environment variables.

Index

Constants

View Source
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"
	IntegrationTestsEnvironment = "integration-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.devsandbox.dev/auth/js/keycloak.js"

	// DefaultAuthClientConfigRaw specifies the auth client config.
	DefaultAuthClientConfigRaw = `` /* 224-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.devsandbox.dev/auth/realms/devcluster/protocol/openid-connect/certs"

	// DefaultNamespace is the default k8s namespace to use.
	DefaultNamespace = "devcluster"

	DefaultBMCloudApiCallRetrySec = 30

	DefaultBMCloudApiCallTimeoutSec = 24 * 60 * 60 // 24 hours

	DefaultIBMCloudIDPName = "devcluster"

	DefaultMongodbDatabase = "devcluster"
)

Variables

View Source
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 New

func New() *Config

New creates a new configuration

func (*Config) GetAuthClientConfigAuthContentType

func (c *Config) GetAuthClientConfigAuthContentType() string

GetAuthClientConfigAuthContentType returns the auth config config content type (as set via config file or environment variable).

func (*Config) GetAuthClientConfigAuthRaw

func (c *Config) GetAuthClientConfigAuthRaw() string

GetAuthClientConfigAuthRaw returns the auth config config (as set via config file or environment variable).

func (*Config) GetAuthClientLibraryURL

func (c *Config) GetAuthClientLibraryURL() string

GetAuthClientLibraryURL returns the auth library location (as set via config file or environment variable).

func (*Config) GetAuthClientPublicKeysURL

func (c *Config) GetAuthClientPublicKeysURL() string

GetAuthClientPublicKeysURL returns the public keys URL (as set via config file or environment variable).

func (*Config) GetEnvironment

func (c *Config) GetEnvironment() string

GetEnvironment returns the environment such as prod, stage, unit-tests, e2e-tests, dev, etc

func (*Config) GetGracefulTimeout

func (c *Config) GetGracefulTimeout() time.Duration

GetGracefulTimeout returns the duration for which the server gracefully wait for existing connections to finish - e.g. 15s or 1m.

func (*Config) GetHTTPAddress

func (c *Config) GetHTTPAddress() string

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

func (c *Config) GetHTTPCompressResponses() bool

GetHTTPCompressResponses returns true if HTTP responses should be compressed for clients that support it via the 'Accept-Encoding' header.

func (*Config) GetHTTPIdleTimeout

func (c *Config) GetHTTPIdleTimeout() time.Duration

GetHTTPIdleTimeout returns the duration for the idle timeout.

func (*Config) GetHTTPReadTimeout

func (c *Config) GetHTTPReadTimeout() time.Duration

GetHTTPReadTimeout returns the duration for the read timeout.

func (*Config) GetHTTPWriteTimeout

func (c *Config) GetHTTPWriteTimeout() time.Duration

GetHTTPWriteTimeout returns the duration for the write timeout.

func (*Config) GetIBMCloudAPIKey

func (c *Config) GetIBMCloudAPIKey() string

GetIBMCloudAPIKey returns the IBM Cloud API Key

func (*Config) GetIBMCloudAccountID

func (c *Config) GetIBMCloudAccountID() string

GetIBMCloudAccountID returns the main/parent IBM Cloud Account ID

func (*Config) GetIBMCloudApiCallRetrySec

func (c *Config) GetIBMCloudApiCallRetrySec() int

GetIBMCloudApiCallRetrySec returns the number of seconds to wait between retrying calling IBM API

func (*Config) GetIBMCloudApiCallTimeoutSec

func (c *Config) GetIBMCloudApiCallTimeoutSec() int

GetIBMCloudApiCallTimeoutSec returns the timeout of waitinf for the cluster to get ready in seconds

func (*Config) GetIBMCloudIDPName

func (c *Config) GetIBMCloudIDPName() string

GetIBMCloudIDPName returns the IDP name

func (*Config) GetIBMCloudTenantID

func (c *Config) GetIBMCloudTenantID() string

GetIBMCloudTenantID returns the Cloud Directory ID

func (*Config) GetLogLevel

func (c *Config) GetLogLevel() string

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

func (*Config) GetMongodbCA

func (c *Config) GetMongodbCA() string

GetMongodbCA returns the Certificate Authority which should be used to connect to the mongo database

func (*Config) GetMongodbConnectionString

func (c *Config) GetMongodbConnectionString() string

func (*Config) GetMongodbDatabase

func (c *Config) GetMongodbDatabase() string

GetMongodbDatabase returns the mongo database name

func (*Config) GetNamespace

func (c *Config) GetNamespace() string

GetNamespace returns the namespace in which the devcluster service and host operator is running

func (*Config) GetViperInstance

func (c *Config) GetViperInstance() *viper.Viper

GetViperInstance returns the underlying Viper instance.

func (*Config) IsLogJSON

func (c *Config) IsLogJSON() bool

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

func (*Config) IsTestingMode

func (c *Config) IsTestingMode() bool

IsTestingMode returns if the service runs in unit-tests environment

Jump to

Keyboard shortcuts

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