juiceconfig

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

juiceconfig Abstract configurations between JSON file, Secrets Manager, and environment variables.

Index

Constants

View Source
const (
	FILE_PREFIX            = "file:::"
	SECRETS_MANAGER_PREFIX = "secrets_manager:::"
	ENVIRONMENT_PREFIX     = "environment:::"
)

Variables

This section is empty.

Functions

func ErrorMessage

func ErrorMessage() string

ErrorMessage Get the previous error's message

func GetBool

func GetBool(path string, dflt ...bool) (bool, error)

GetBool Get a boolean value from the config defined by JUICE_CONFIG.

func GetInt

func GetInt(path string, dflt ...int64) (int64, error)

GetInt Get an integer value from the config defined by JUICE_CONFIG.

func GetString

func GetString(path string, dflt ...string) (string, error)

GetString Get a string value from the config defined by JUICE_CONFIG.

func ResetError

func ResetError()

ResetError Reset the error status.

func WasError

func WasError() bool

WasError Has an error occurred?

  • Rather than checking for errors every time we get a config value,
  • we can check at the end.

Types

type JuiceConfig

type JuiceConfig struct {
	URL string
	// contains filtered or unexported fields
}

JuiceConfig Configuration object loading using a URL.

func Load

func Load(url string) (*JuiceConfig, error)

Load Load configuration

func (*JuiceConfig) ErrorMessage

func (jc *JuiceConfig) ErrorMessage() string

ErrorMessage Return description of previous error

func (*JuiceConfig) GetBool

func (jc *JuiceConfig) GetBool(path string, dflt ...bool) (bool, error)

GetBool Get an integer configuration value

func (*JuiceConfig) GetInt

func (jc *JuiceConfig) GetInt(path string, dflt ...int64) (int64, error)

GetInt Get an integer configuration value

func (*JuiceConfig) GetString

func (jc *JuiceConfig) GetString(path string, dflt ...string) (string, error)

GetString Get a string configuration value

func (*JuiceConfig) ResetError

func (jc *JuiceConfig) ResetError()

ResetError Reset the error stat.s

func (*JuiceConfig) WasError

func (jc *JuiceConfig) WasError() bool

WasError Has an error occurred?

  • Rather than checking for errors every time we get a config value,
  • we can check at the end.

Jump to

Keyboard shortcuts

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