engine

package
v0.0.0-...-0bd6e25 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package engine defines a config engine for the entire app in the dev context.

The config features:

  • reads the command line arguments for the app such as authentication enabled or not.
  • automatically loads the environment variables files.
  • Allows setting default variables if user didn't define them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func YamlPathParam

func YamlPathParam(configPath string, configName string) key_value.KeyValue

YamlPathParam creates a file parameter.

Types

type Dev

type Dev struct {
	*viper.Viper // used to keep default values

	// Passed as --secure command line arg.
	// If it's passed, then authentication is switched off.
	Secure       bool
	HandleChange func(interface{}, error)
}

Dev context's configuration engine on viper.Viper

func NewDev

func NewDev() (*Dev, error)

NewDev creates a global config for the entire application.

Automatically reads the command line arguments. Loads the environment variables.

func (*Dev) Exist

func (config *Dev) Exist(name string) bool

Exist Checks whether the config variable exists or not If the config exists or its default value exists, then returns true.

func (*Dev) SetDefaults

func (config *Dev) SetDefaults(params key_value.KeyValue)

SetDefaults sets the default config parameters.

Jump to

Keyboard shortcuts

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