config

package
v1.1.183 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EvPrefix environment variable prefix
	EvPrefix = "ISLA"

	// EvSuffixForAPIClientHTTPTimeout environment variable name for API client http timeout
	EvSuffixForAPIClientHTTPTimeout = "APICLIENT_HTTP_TIMEOUT"
	// EvSuffixForDBHost environment variable name for database host
	EvSuffixForDBHost = "DB_HOST"
	// EvSuffixForDBConnectionLifetime environment variable name for connection lifetime in database connection pool
	EvSuffixForDBConnectionLifetime = "DB_CONNECTION_MAX_LIFETIME"
	// EvSuffixForDBLogLevel environment variable name for database log level
	EvSuffixForDBLogLevel = "DB_LOG_LEVEL"
	// EvSuffixForDBMaxIdleConnections environment variable name for max idle connections in database connection pool
	EvSuffixForDBMaxIdleConnections = "DB_MAX_IDLE_CONNECTIONS"
	// EvSuffixForDBMaxOpenConnections environment variable name for max open connections in database connection pool
	EvSuffixForDBMaxOpenConnections = "DB_MAX_OPEN_CONNECTIONS"
	// EvSuffixForDBPassword environment variable name for database bind user password
	EvSuffixForDBPassword = "DB_PWD"
	// EvSuffixForDBPort environment variable name for database port
	EvSuffixForDBPort = "DB_PORT"
	// EvSuffixForDBRequired environment variable name for database required flag
	EvSuffixForDBRequired = "DB_REQUIRED"
	// EvSuffixForDBUser environment variable name for database bind user
	EvSuffixForDBUser = "DB_USER"
	// EvSuffixForHTTPIdleTimeout environment variable name for HTT idle timeout
	EvSuffixForHTTPIdleTimeout = "HTTP_IDLE_TIMEOUT"
	// EvSuffixForHTTPReadTimeout environment variable name for HTTP read timeout
	EvSuffixForHTTPReadTimeout = "HTTP_READ_TIMEOUT"
	// EvSuffixForHTTPWriteTimeout environment variable name for http write timeout
	EvSuffixForHTTPWriteTimeout = "HTTP_WRITE_TIMEOUT"
	// EvSuffixForJwtSecret environment variable name for JWT secrete
	EvSuffixForJwtSecret = "JWT_SECRET"
	// EvSuffixForLogLevel environment variable name for log level
	EvSuffixForLogLevel = "LOG_LEVEL"
	// EvSuffixForGormSlowThreshold environment variable name for log level
	EvSuffixForGormSlowThreshold = "GORM_SLOW_THRESHOLD"
	// EvSuffixForEnableHealthLog environment variable name for log level
	EvSuffixForEnableHealthLog = "ENABLE_HEALTH_LOG"
	// EvSuffixForEnableMetrics environment variable name for enable metrics
	EvSuffixForEnableMetrics = "ENABLE_METRICS"
	// EvSuffixForGormMetricsRefresh environment variable name for gorm metrics refresh interval
	EvSuffixForGormMetricsRefresh = "GORM_METRICS_REFRESH_INTERVAL"
	// EvSuffixForSettingsMetadataPath environment variable name for settings metadata path
	EvSuffixForSettingsMetadataPath = "SETTINGS_METADATA_PATH"
	// EvSuffixForGlobalSettingsMetadataPath environment variable name for global settings metadata path
	EvSuffixForGlobalSettingsMetadataPath = "GLOBAL_SETTINGS_METADATA_PATH"
	// EvSuffixForMemCachedHost environment variable name for Memcached host
	EvSuffixForMemCachedHost = "MEMCACHED_HOST"
	// EvSuffixForMemCachedPort environment variable name for Memcached Port
	EvSuffixForMemCachedPort = "MEMCACHED_PORT"
	// EvSuffixForMemCachedRequired environment variable name for memcached required flag
	EvSuffixForMemCachedRequired = "MEMCACHED_REQUIRED"
	// EvSuffixForSkipInsecureTLSVerification environment variable name for skipping insecure tls verification
	EvSuffixForSkipInsecureTLSVerification = "TLS_INSECURE_SKIP_VERIFY"
	// EvSuffixForEnableTLS environment variable name for enabling tls
	EvSuffixForEnableTLS = "ENABLE_TLS"
	// EvSuffixForTLSServerName environment variable name for tls server name
	EvSuffixForTLSServerName = "TLS_SERVER_NAME"
	// EvSuffixForTLSCert environment variable name for tls certificate
	EvSuffixForTLSCert = "TLS_CRT"
	// EvSuffixForTLSKey environment variable name for tls private key
	EvSuffixForTLSKey = "TLS_KEY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config sdk for getting key values from settings file

func NewConfig

func NewConfig(defaults map[string]interface{}) *Config

NewConfig initializes configuration from settings file

func (*Config) GetBool

func (config *Config) GetBool(key string) bool

GetBool returns boolean value set for the given key

func (*Config) GetBoolWithDefault added in v1.0.0

func (config *Config) GetBoolWithDefault(key string, defaultVal bool) bool

GetBoolWithDefault returns boolean value set for the given key, if not set returns the given defaultVal

func (*Config) GetInt

func (config *Config) GetInt(key string) int

GetInt return int value set for the given key

func (*Config) GetMap added in v0.0.54

func (config *Config) GetMap(key string) map[string]interface{}

GetMap returns the value associated with the given key as a map of interfaces

func (*Config) GetMapString added in v0.0.52

func (config *Config) GetMapString(key string) map[string]string

GetMapString returns the value associated with the given key as a map of strings

func (*Config) GetString

func (config *Config) GetString(key string) string

GetString return string value set for a given key

func (*Config) GetStringWithDefault added in v1.0.0

func (config *Config) GetStringWithDefault(key string, defaultVal string) string

GetStringWithDefault return string value set for the given key, if not set returns the given defaultVal

func (*Config) IsSet

func (config *Config) IsSet(key string) bool

IsSet checks if the give key's value been set

func (*Config) Set added in v1.0.18

func (config *Config) Set(key string, value interface{})

Set sets the value for the given key

Jump to

Keyboard shortcuts

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