config

package
v0.0.0-...-d772fc0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const KhronosConfigFileKey = "KHRONOS_CONFIG_FILE"

KhronosConfigFileKey is the env var key that will tell wich config file to take

Variables

View Source
var (
	// ValidStorageEngines contains the selectable storage engines
	ValidStorageEngines = []string{"dummy", "boltdb"}
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	// Server configuration
	*config.Server

	// BoltDB configuration
	*BoltDB

	// Service configuration
	*Khronos

	// Json Configuration path
	ConfigFilePath string
}

AppConfig holds the configuration of the application

func NewAppConfig

func NewAppConfig(configFile string) *AppConfig

NewAppConfig creates a new app configuration with all the settings loaded

func (*AppConfig) ConfigureApp

func (a *AppConfig) ConfigureApp()

ConfigureApp loads all the application settings with a priority: First loads settings from file, then loads the settings from env vars.

type BoltDB

type BoltDB struct {
	BoltDBPath           string `envconfig:"BOLTDB_PATH" default:"data/khronos.db"`
	BoltDBTimeoutSeconds int    `envconfig:"BOLTDB_TIMEOUT_SECONDS" default:"1"`
}

BoltDB holds the configuration of storage

func (*BoltDB) LoadBoltDBConfig

func (b *BoltDB) LoadBoltDBConfig(cfg *AppConfig)

LoadBoltDBConfig loads boltdb env and jsonfile config

type Khronos

type Khronos struct {
	// ResultBufferLen is default result channel length
	ResultBufferLen int `envconfig:"KHRONOS_RESULT_BUFFER_LEN"`

	// StorageEngine is the engine used to store the data
	StorageEngine string `envconfig:"KHRONOS_STORAGE_ENGINE"`

	//DontScheduleJobsStart flag, specifies to not schedule jobs at app startup
	DontScheduleJobsStart bool `envconfig:"KHRONOS_DONT_SCHEDULE_JOBS_ON_START"`

	//APIResourcesPerPage integer, specifies how many objects will the API return
	APIResourcesPerPage int `envconfig:"KHRONOS_API_RESOURCES_PER_PAGE"`

	//APIDisableSecurity Disable API security
	APIDisableSecurity bool `envconfig:"KHRONOS_API_DISABLE_SECURITY"`
}

Khronos holds the configuration of the main application

func (*Khronos) LoadDefaults

func (k *Khronos) LoadDefaults()

LoadDefaults loads defaults settings

func (*Khronos) LoadKhronosConfig

func (k *Khronos) LoadKhronosConfig(cfg *AppConfig)

LoadKhronosConfig Loads the configuration for the application

Jump to

Keyboard shortcuts

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