cfg

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

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",
		Encode:    false,
	},
}

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"`
	Encode    bool   `yaml:"encode" envconfig:"LOG_ENCODE"`
}

LogConfig to configure logging.

Jump to

Keyboard shortcuts

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