cfg

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Suite:       "golium",
	Environment: "local",
	Dir: DirConfig{
		Config:       "./",
		Schemas:      "./schemas",
		Environments: "./environments",
	},
	Log: LogConfig{
		Directory: "./logs",
		Level:     "INFO",
	},
}

DefaultConfig is the default configuration for golium. This default configuration can be overridden with environment variables.

Functions

func Load

func Load(path string, config interface{}) error

Load reads the configuration from a yml file (at path) and from environment variables.

func LoadEnv

func LoadEnv(config interface{}) error

LoadEnv loads the environment variables into config struct.

func LoadYaml

func LoadYaml(path string, config interface{}) error

LoadYaml reads a yaml file at path in the config struct.

Types

type Config

type Config struct {
	Suite       string    `yaml:"suite" envconfig:"SUITE"`
	Environment string    `yaml:"environment" envconfig:"ENVIRONMENT"`
	Dir         DirConfig `yaml:"dir"`
	Log         LogConfig `yaml:"log"`
}

Config contains the configuration for golium project.

type DirConfig

type DirConfig struct {
	Config       string `yaml:"config" envconfig:"DIR_CONFIG"`
	Schemas      string `yaml:"schemas" envconfig:"DIR_SCHEMAS"`
	Environments string `yaml:"environments" envconfig:"DIR_ENVIRONMENTS"`
}

DirConfig to configure some configuration directories.

type LogConfig

type LogConfig struct {
	Directory string `yaml:"directory" envconfig:"LOG_DIRECTORY"`
	Level     string `yaml:"level" envconfig:"LOG_LEVEL"`
}

LogConfig to configure logging.

Jump to

Keyboard shortcuts

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