Documentation ¶
Index ¶
- func LoadConfigForEnv(config Config) error
- func LoadConfigFromPathForEnv(searchPath string, config Config) error
- func ReadConfiguration(configFilePath string, config Config) error
- type BaseConfig
- func (cfg BaseConfig) GetEnvironment() string
- func (cfg BaseConfig) GetGcpConfig() *GcpConfig
- func (cfg BaseConfig) GetLoggingConfig() *LoggingConfig
- func (cfg BaseConfig) GetServerConfig() *ServerConfig
- func (cfg BaseConfig) GetServiceName() string
- func (cfg BaseConfig) GetVersion() string
- func (cfg BaseConfig) IsLocalEnvironment() bool
- type Config
- type GcpConfig
- type Image
- type LoggingConfig
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadConfigForEnv ¶
func LoadConfigFromPathForEnv ¶
LoadConfigFromPathForEnv - search the property-<ENV> properties in the given search path (for ex. "./config" )
func ReadConfiguration ¶
ReadConfiguration reads the configuration from the file and environment variables
Types ¶
type BaseConfig ¶
type BaseConfig struct { Name string `mapstructure:"name"` Environment string `mapstructure:"environment"` Version string `mapstructure:"version"` Logging *LoggingConfig `mapstructure:"logging"` Server *ServerConfig `mapstructure:"server"` Gcp *GcpConfig `mapstructure:"gcp"` Image *Image `mapstructure:"image"` }
BaseConfig - app config struct. This struct represents the base configuration for the application and is expected to be in the following YAML format:
name: "TestApp" environment: "development" version: "1.0" logging:
level: "debug"
gcp:
projectNumber: 620222630834 project: test-project location: europe-west4
image:
repository: europe-west4-docker.pkg.dev/ingka-opoa-nexus-dev/nexus-docker-repo name: test-app pullPolicy: Always tag: latest
server:
port: "8080" concurrency: 10 disableStartupMsg: false bodyLimit: 1048576
func (BaseConfig) GetEnvironment ¶
func (cfg BaseConfig) GetEnvironment() string
func (BaseConfig) GetGcpConfig ¶
func (cfg BaseConfig) GetGcpConfig() *GcpConfig
func (BaseConfig) GetLoggingConfig ¶
func (cfg BaseConfig) GetLoggingConfig() *LoggingConfig
func (BaseConfig) GetServerConfig ¶
func (cfg BaseConfig) GetServerConfig() *ServerConfig
func (BaseConfig) GetServiceName ¶
func (cfg BaseConfig) GetServiceName() string
func (BaseConfig) GetVersion ¶
func (cfg BaseConfig) GetVersion() string
func (BaseConfig) IsLocalEnvironment ¶
func (cfg BaseConfig) IsLocalEnvironment() bool
type Config ¶
type Config interface { GetServiceName() string GetVersion() string GetEnvironment() string GetServerConfig() *ServerConfig GetGcpConfig() *GcpConfig GetLoggingConfig() *LoggingConfig IsLocalEnvironment() bool }
Config - config interface.
type Image ¶
type Image struct { Repository string `mapstructure:"repository"` Name string `mapstructure:"name"` PullPolicy string `mapstructure:"pullPolicy"` Tag string `mapstructure:"tag"` }
Image - Image properties
type LoggingConfig ¶
type LoggingConfig struct {
Level string `mapstructure:"level"`
}
type ServerConfig ¶
type ServerConfig struct { Port string `mapstructure:"port"` Concurrency int `mapstructure:"concurrency"` DisableStartupMessage bool `mapstructure:"disableStartupMsg"` BodyLimit int `mapstructure:"bodyLimit"` }
func (ServerConfig) GetBodyLimit ¶ added in v1.0.3
func (srv ServerConfig) GetBodyLimit() int
Click to show internal directories.
Click to hide internal directories.