Documentation ¶
Overview ¶
Package config provides functions to handle the configurations of job service.
Index ¶
- Constants
- Variables
- func GetAuthSecret() string
- func GetCoreURL() string
- func GetUIAuthSecret() string
- func MaxDanglingHour() int
- func MaxUpdateDuration() time.Duration
- type Configuration
- type CustomizedSettings
- type HTTPSConfig
- type LogSweeperConfig
- type LoggerConfig
- type MetricConfig
- type PoolConfig
- type ReaperConfig
- type RedisPoolConfig
Constants ¶
const ( // JobServiceProtocolHTTPS points to the 'https' protocol JobServiceProtocolHTTPS = "https" // JobServiceProtocolHTTP points to the 'http' protocol JobServiceProtocolHTTP = "http" // JobServicePoolBackendRedis represents redis backend JobServicePoolBackendRedis = "redis" )
Variables ¶
var DefaultConfig = &Configuration{}
DefaultConfig is the default configuration reference
Functions ¶
func MaxDanglingHour ¶
func MaxDanglingHour() int
MaxDanglingHour the max time for an execution can be dangling state
func MaxUpdateDuration ¶
MaxUpdateDuration the max time for an execution can be updated by task
Types ¶
type Configuration ¶
type Configuration struct { // Protocol server listening on: https/http Protocol string `yaml:"protocol"` // Server listening port Port uint `yaml:"port"` // Additional config when using https HTTPSConfig *HTTPSConfig `yaml:"https_config,omitempty"` // Configurations of worker worker PoolConfig *PoolConfig `yaml:"worker_pool,omitempty"` // Job logger configurations JobLoggerConfigs []*LoggerConfig `yaml:"job_loggers,omitempty"` // Logger configurations LoggerConfigs []*LoggerConfig `yaml:"loggers,omitempty"` // Metric configurations Metric *MetricConfig `yaml:"metric,omitempty"` // Reaper configurations ReaperConfig *ReaperConfig `yaml:"reaper,omitempty"` // MaxLogSizeReturnedMB is the max size of log returned by job log API MaxLogSizeReturnedMB int `yaml:"max_retrieve_size_mb,omitempty"` }
Configuration loads and keeps the related configuration items of job service.
func (*Configuration) Load ¶
func (c *Configuration) Load(yamlFilePath string, detectEnv bool) error
Load the configuration options from the specified yaml file. If the yaml file is specified and existing, load configurations from yaml file first; If detecting env variables is specified, load configurations from env variables; Please pay attentions, the detected env variable will override the same configuration item loading from file.
yamlFilePath string: The path config yaml file readEnv bool : Whether detect the environment variables or not
type CustomizedSettings ¶
type CustomizedSettings map[string]interface{}
CustomizedSettings keeps the customized settings of logger
type HTTPSConfig ¶
HTTPSConfig keeps additional configurations when using https protocol
type LogSweeperConfig ¶
type LogSweeperConfig struct { Duration int `yaml:"duration"` Settings CustomizedSettings `yaml:"settings"` }
LogSweeperConfig keeps settings of log sweeper
type LoggerConfig ¶
type LoggerConfig struct { Name string `yaml:"name"` Level string `yaml:"level"` Settings CustomizedSettings `yaml:"settings"` Sweeper *LogSweeperConfig `yaml:"sweeper"` }
LoggerConfig keeps logger basic configurations.
type MetricConfig ¶
type MetricConfig struct { Enabled bool `yaml:"enabled"` Path string `yaml:"path"` Port int `yaml:"port"` }
MetricConfig used for configure metrics
type PoolConfig ¶
type PoolConfig struct { // Worker concurrency WorkerCount uint `yaml:"workers"` Backend string `yaml:"backend"` RedisPoolCfg *RedisPoolConfig `yaml:"redis_pool,omitempty"` }
PoolConfig keeps worker worker configurations.
type ReaperConfig ¶
type RedisPoolConfig ¶
type RedisPoolConfig struct { RedisURL string `yaml:"redis_url"` Namespace string `yaml:"namespace"` // IdleTimeoutSecond closes connections after remaining idle for this duration. If the value // is zero, then idle connections are not closed. Applications should set // the timeout to a value less than the server's timeout. IdleTimeoutSecond int64 `yaml:"idle_timeout_second"` }
RedisPoolConfig keeps redis worker info.