config

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// KeyDebug enables debug messages.
	KeyDebug = "debug"

	// KeyLogLevel logging level (panic, fatal, error, warn, info, debug, disabled).
	KeyLogLevel = "log.level"

	// KeyLogPretty output formatted log lines (for running in foreground).
	KeyLogPretty = "log.pretty"

	// KeyShowConfig - show configuration and exit.
	KeyShowConfig = "show-config"

	// KeyShowVersion - show version information and exit.
	KeyShowVersion = "version"
)

NOTE: adding a Key* MUST be reflected in the Config structures above.

Variables

View Source
var (
	// MetricNameSeparator defines character used to delimit metric name parts.
	MetricNameSeparator = defaults.MetricNameSeparator // var, TBD whether it will become configurable
)

Functions

func LoadConfigFile

func LoadConfigFile(base string, target interface{}) error

LoadConfigFile will attempt to load json|toml|yaml configuration files. `base` is the full path and base name of the configuration file to load. `target` is an interface in to which the data will be loaded. Checks for '<base>.json', '<base>.toml', and '<base>.yaml'.

func ShowConfig

func ShowConfig(w io.Writer) error

ShowConfig prints the running configuration.

func StatConfig

func StatConfig() error

StatConfig adds the running config to the app stats.

func Validate

func Validate() error

Validate verifies the required portions of the configuration.

func VerifyFile

func VerifyFile(fileName string) (string, error)

VerifyFile ensures a file exists and is readable. It returns the normalized name and an error, if encountered.

Types

type AWSConfig

type AWSConfig struct {
	ConfDir string `json:"conf_dir" toml:"conf_dir" yaml:"conf_dir"`
	Enabled bool   `json:"enabled" toml:"enabled" yaml:"enabled"`
}

AWSConfig defines the AWS cloud service configuration.

type AzureConfig

type AzureConfig struct {
	ConfDir string `json:"conf_dir" toml:"conf_dir" yaml:"conf_dir"`
	Enabled bool   `json:"enabled" toml:"enabled" yaml:"enabled"`
}

AzureConfig defines the Azure cloud service configuration.

type Config

type Config struct {
	AWS         *AWSConfig   `json:"aws" toml:"aws" yaml:"aws"`
	Azure       *AzureConfig `json:"azure" toml:"azure" yaml:"azure"`
	GCP         *GCPConfig   `json:"gcp" toml:"gcp" yaml:"gcp"`
	Log         Log          `json:"log" yaml:"log" toml:"log"`
	Debug       bool         `json:"debug" yaml:"debug" toml:"debug"`
	PipeSubmits bool         `json:"pipe_submits" toml:"pipe_submits" yaml:"pipe_submits"`
}

Config defines the running config structure.

type GCPConfig

type GCPConfig struct {
	ConfDir string `json:"conf_dir" toml:"conf_dir" yaml:"conf_dir"`
	Enabled bool   `json:"enabled" toml:"enabled" yaml:"enabled"`
}

GCPConfig defines the AWS cloud service configuration.

type Log

type Log struct {
	Level  string `json:"level" yaml:"level" toml:"level"`
	Pretty bool   `json:"pretty" yaml:"pretty" toml:"pretty"`
}

Log defines the running config.log structure.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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