config

package module
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: MIT Imports: 14 Imported by: 2

README

config

config with a conventional directory structure.

Build Status Coverage Status Go Report Card Documentation

Install

$ go get github.com/lovego/config

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alarm

func Alarm() *alarm.Alarm
func Cookie() http.Cookie

func DeployName

func DeployName() string

func Dir added in v0.0.6

func Dir() string

func Env

func Env() *config.Environment

func ExternalURL added in v0.0.7

func ExternalURL() *url.URL
Example
fmt.Println(ExternalURL().String())
Output:

https://example.com/home

func ExternalURLIsHTTPS added in v0.0.8

func ExternalURLIsHTTPS() bool

func FilePath added in v0.3.0

func FilePath(env *config.Environment) string

func Get

func Get(key string) strmap.StrMap

func GetDBConfig added in v0.0.6

func GetDBConfig(typ, key string) interface{}

func GetSlice

func GetSlice(key string) []strmap.StrMap

func GetString

func GetString(key string) string

func GetStringSlice

func GetStringSlice(key string) []string

func HttpLogger

func HttpLogger() *loggerPkg.Logger

func Keepers

func Keepers() []string

func Logger

func Logger() *loggerPkg.Logger

func Mailer

func Mailer() *email.Client

func Name

func Name() string

func NewLogger

func NewLogger(paths ...string) *loggerPkg.Logger

func NewLoggerFromWriter

func NewLoggerFromWriter(writer io.Writer) *loggerPkg.Logger

func Protect

func Protect(fn func())

func Root

func Root() string
Example
root := Root()
fmt.Println(strings.HasSuffix(root, "/config/release/img-app"))
Output:

true

func Secret

func Secret() string

func TimeZone

func TimeZone() *time.Location

func TimestampSign

func TimestampSign(timestamp int64) string

Types

This section is empty.

Directories

Path Synopsis
The parent config package get root dir when init, it panics if no root is found.
The parent config package get root dir when init, it panics if no root is found.
db
this package must be imported first, to ensure it is initialized before all the other package.
this package must be imported first, to ensure it is initialized before all the other package.

Jump to

Keyboard shortcuts

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