config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultHost = func() string { return viper.GetString("host_default") }
	RootDomain  = func() string { return viper.GetString("root_domain") }
	ListenHTTP  = func() string { return viper.GetString("listen_http") }
	ListenHTTPS = func() string { return viper.GetString("listen_https") }

	LogLevel        = func() string { return viper.GetString("log_level") }
	LogFormat       = func() string { return viper.GetString("log_format") }
	LogOutput       = func() string { return viper.GetString("log_output") }
	LogPretty       = func() bool { return viper.GetBool("log_pretty") }
	AccessLogOutput = func() string { return viper.GetString("log_access_output") }

	GoogleRecaptchaSecret = func() string { return viper.GetString("google_recaptcha_secret") }

	ConsoleProxyURL = func() string { return viper.GetString("console_proxy_url") }
)

define main configs.

View Source
var (

	// JSONLogFormatter formats logs into parsable json.
	JSONLogFormatter = &log.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000-07:00", CallerPrettyfier: callerPretty, DisableHTMLEscape: true}

	// TextLogFormatter formats logs into text.
	TextLogFormatter = &log.TextFormatter{TimestampFormat: "2006-01-02T15:04:05.000-07:00", FullTimestamp: true, CallerPrettyfier: callerPretty}
)

Functions

func Help

func Help() string

Help get help messages.

func Load

func Load() error

Load all configs.

func LogWriter

func LogWriter(output string) io.Writer

LogWriter get an io.Writer according to the output.

func Mailer

func Mailer() mail.Mailer

Mailer returns the mail client.

func MySQL

func MySQL() *gorm.DB

MySQL returns the mysql client instance.

func Redis

func Redis() *redis.Client

Redis returns the redis client instance.

Types

This section is empty.

Jump to

Keyboard shortcuts

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