config

package
v0.0.0-...-09c3194 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSON ConfigFileType = iota
	TOML                = iota
	YAML                = iota
)

Variables

View Source
var (
	ErrInvalidFileType = errors.New("config: invalid file type")
)

errors

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func Init

func Init(configFilePath string, fileType ConfigFileType, isEncrypted bool) (Config, error)

Init - read a config file optionally decrypt it and construct config struct

func (Config) Get

func (c Config) Get(path string) gjson.Result

Get - get value from config

func (Config) GetBool

func (c Config) GetBool(path string) bool

GetBool - get value from config and type cast to boolean

func (Config) GetInt

func (c Config) GetInt(path string) int64

GetInt - get value from config and type cast to int

func (Config) GetString

func (c Config) GetString(path string) string

GetString - get value from config and type cast to string

type ConfigFileType

type ConfigFileType int

Jump to

Keyboard shortcuts

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