config

package
v1.5.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config provides functions to handle the configurations of job service.

Index

Constants

View Source
const (

	//JobServiceProtocolHTTPS points to the 'https' protocol
	JobServiceProtocolHTTPS = "https"
	//JobServiceProtocolHTTP points to the 'http' protocol
	JobServiceProtocolHTTP = "http"

	//JobServicePoolBackendRedis represents redis backend
	JobServicePoolBackendRedis = "redis"
)

Variables

View Source
var DefaultConfig = &Configuration{}

DefaultConfig is the default configuration reference

Functions

func GetAdminServerEndpoint added in v1.5.0

func GetAdminServerEndpoint() string

GetAdminServerEndpoint return the admin server endpoint

func GetAuthSecret added in v1.5.0

func GetAuthSecret() string

GetAuthSecret get the auth secret from the env

func GetLogArchivePeriod added in v1.5.0

func GetLogArchivePeriod() uint

GetLogArchivePeriod returns the archive period

func GetLogBasePath added in v1.5.0

func GetLogBasePath() string

GetLogBasePath returns the log base path config

func GetLogLevel added in v1.5.0

func GetLogLevel() string

GetLogLevel returns the log level

func GetUIAuthSecret added in v1.5.0

func GetUIAuthSecret() string

GetUIAuthSecret get the auth secret of UI side

Types

type Configuration added in v1.5.0

type Configuration struct {
	//Protocol server listening on: https/http
	Protocol string `yaml:"protocol"`

	//Server listening port
	Port uint `yaml:"port"`

	AdminServer string `yaml:"admin_server"`

	//Additional config when using https
	HTTPSConfig *HTTPSConfig `yaml:"https_config,omitempty"`

	//Configurations of worker pool
	PoolConfig *PoolConfig `yaml:"worker_pool,omitempty"`

	//Logger configurations
	LoggerConfig *LoggerConfig `yaml:"logger,omitempty"`
}

Configuration loads and keeps the related configuration items of job service.

func (*Configuration) Load added in v1.5.0

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 HTTPSConfig added in v1.5.0

type HTTPSConfig struct {
	Cert string `yaml:"cert"`
	Key  string `yaml:"key"`
}

HTTPSConfig keeps additional configurations when using https protocol

type LoggerConfig added in v1.5.0

type LoggerConfig struct {
	BasePath      string `yaml:"path"`
	LogLevel      string `yaml:"level"`
	ArchivePeriod uint   `yaml:"archive_period"`
}

LoggerConfig keeps logger configurations.

type PoolConfig added in v1.5.0

type PoolConfig struct {
	//Worker concurrency
	WorkerCount  uint             `yaml:"workers"`
	Backend      string           `yaml:"backend"`
	RedisPoolCfg *RedisPoolConfig `yaml:"redis_pool,omitempty"`
}

PoolConfig keeps worker pool configurations.

type RedisPoolConfig added in v1.5.0

type RedisPoolConfig struct {
	RedisURL  string `yaml:"redis_url"`
	Namespace string `yaml:"namespace"`
}

RedisPoolConfig keeps redis pool info.

Jump to

Keyboard shortcuts

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