vxconf

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsProd

func IsProd() bool

IsProd return true if app is in production mode.

func JSONToString added in v1.2.3

func JSONToString(in interface{}, pretty bool) string

JSONToString convert json object `in` to json text string

func LoadSectionTo

func LoadSectionTo(runMode, sectionKeyPath string, configHolder interface{}) (err error)

LoadSectionTo returns error while cannot yaml Marshal and Unmarshal

func ParseJSON added in v1.2.3

func ParseJSON(cfg string) (*config.AppConfig, error)

ParseJSON reads a JSON configuration from the given string.

func ParseJSONFile added in v1.2.3

func ParseJSONFile(filename string) (*config.AppConfig, error)

ParseJSONFile reads a JSON configuration from the given filename.

func ParseYaml

func ParseYaml(cfg string) (*config.AppConfig, error)

ParseYaml reads a YAML configuration from the given string.

func ParseYamlFile

func ParseYamlFile(filename string) (*config.AppConfig, error)

ParseYamlFile reads a YAML configuration from the given filename.

func RenderJSON added in v1.2.3

func RenderJSON(cfg interface{}) (string, error)

RenderJSON renders a JSON configuration.

func RenderYaml

func RenderYaml(cfg interface{}) (string, error)

RenderYaml renders a YAML configuration.

func RunMode added in v1.2.3

func RunMode(defaultVal ...string) (runMode string)

RunMode return running mode string: prod, devel, staging, ...

func RunModeExt added in v1.2.3

func RunModeExt(defaultVal ...string) (runMode string)

RunModeExt return running mode and position: prod-newyork, devel-paris, staging, ...

func UnescapeUnicode

func UnescapeUnicode(b []byte) string

UnescapeUnicode 解码 \uxxxx 为 unicode 字符; 但是输入的 b 应该是 yaml 格式

func YamlToString

func YamlToString(in interface{}, pretty bool) string

YamlToString convert yaml object `in` to yaml text string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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