config

package
v0.0.0-...-2dd72ea Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlobToRSAPublicKey

func BlobToRSAPublicKey(blob []byte) (pk *rsa.PublicKey, err error)

func FileToBytes

func FileToBytes(filenameParts ...string) ([]byte, error)

func FileToString

func FileToString(filenameParts ...string) (string, error)

func GetFilename

func GetFilename(filenameParts ...string) string

func GetRoot

func GetRoot() string

func InitApp

func InitApp(root string) (err error)

InitApp creates an in-memory-config containing only a single value: `config.root`

func ReadJSON

func ReadJSON(result interface{}, filenameParts ...string) error

func ReadRSAPrivateKey

func ReadRSAPrivateKey(filename string) (pk *rsa.PrivateKey, err error)

func ReadRSAPublicKey

func ReadRSAPublicKey(filename string) (pk *rsa.PublicKey, err error)

func ReadYAML

func ReadYAML(result interface{}, filenameParts ...string) error

func StringToRSAPublicKey

func StringToRSAPublicKey(str string) (pk *rsa.PublicKey, err error)

Types

type Config

type Config interface {
	Get(path ...interface{}) (Config, error)
	GetString(path ...interface{}) string
	GetBool(path ...interface{}) bool
	GetArray(path ...interface{}) []Config
	GetMap(path ...interface{}) (ConfigMap, error)
	MakeMap(path ...interface{}) (ConfigMap, error)
	AddArrayElement(obj interface{}, path ...interface{}) error
	SetString(name, value string) error
	Write() error
}

func GetConfig

func GetConfig() (c Config)

func GetOrCreateConfigFile

func GetOrCreateConfigFile(filenameParts ...string) (Config, error)

func New

func New(filename string, cfg interface{}) (c Config)

func ReadConfigFile

func ReadConfigFile(filenameParts ...string) (Config, error)

type ConfigMap

type ConfigMap interface {
	Config
}

Jump to

Keyboard shortcuts

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