cconfig

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 11 Imported by: 5

Documentation

Overview

Package cconfig helps read app config easily with support for different environments

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	Env() Env
	Load(key string, dest interface{}) error
}

Config provides methods to read app config.

func New

func New(dir Dir, projectDir ProjectDir, env Env) (Config, error)

New provides an implementation of Config that reads config files in the dir. By default, it reads from base.toml and can be overridden by a file corresponding to the env. For 'test' env, the file should be test.toml.

type Dir

type Dir string

Dir defines the directory where config file(s) live.

type Env

type Env string

Env defines the various environments the app can be configured for. The Env may be dev, test, staging, or prod.

type ProjectDir

type ProjectDir string

ProjectDir defines the project directory. This variable can be used in the config file with {{ .ProjectDir }}. It is set by passing a -project flag to the app binary.

Directories

Path Synopsis
Package cconfigtest provides helper methods to test the cconfig package
Package cconfigtest provides helper methods to test the cconfig package

Jump to

Keyboard shortcuts

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