Documentation ¶
Index ¶
- Constants
- Variables
- func FullInfo() string
- func SetDefaultConfig(baseDir string)
- func SetDefaultDaemon()
- func SetDefaultLog(baseDir string)
- func SetDefaultServer(baseDir string)
- func ShortInfo() string
- func TrimSpaceOfArg(arg string) string
- func ValidateConfig() (err error)
- func ValidateDaemon() error
- func ValidateLog() error
- func ValidateServer() error
Constants ¶
View Source
const ( DefaultCommandName = "go-template-web" DefaultBaseDir = constant.CurrentDir // daemon DefaultDaemon = false DaemonArg = "--daemon" DaemonArgTrue = "--daemon=true" DaemonArgFalse = "--daemon=false" // log DefaultLogDir = "./log" MinLogMaxSize = 1 MaxLogMaxSize = constant.MaxInt MinLogMaxDays = 1 MaxLogMaxDays = constant.MaxInt MinLogMaxBackups = 1 MaxLogMaxBackups = constant.MaxInt DefaultRotateOnStartup = false DefaultLogStdout = false // server DefaultServerAddr = "0.0.0.0:80" DefaultServerReadTimeout = 5 DefaultServerWriteTimeout = 10 MinServerReadTimeout = 0 MaxServerReadTimeout = 60 MinServerWriteTimeout = 1 MaxServerWriteTimeout = 60 DefaultServerPProfEnabled = false DefaultServerRouterAlternativeBasePath = constant.EmptyString DefaultServerRouterAlternativeBodyPath = constant.EmptyString DefaultServerRouterHTTPErrorCode = http.StatusInternalServerError )
global constant
View Source
const ( // config ConfKey = "config" // daemon DaemonKey = "daemon" // log LogFileNameKey = "log.fileName" LogLevelKey = "log.level" LogFormatKey = "log.format" LogMaxSizeKey = "log.maxSize" LogMaxDaysKey = "log.maxDays" LogMaxBackupsKey = "log.maxBackups" LogRotateOnStartupKey = "log.rotateOnStartup" LogStdoutKey = "log.stdout" // server ServerAddrKey = "server.addr" ServerPidFileKey = "server.pidFile" ServerReadTimeoutKey = "server.readTimeout" ServerWriteTimeoutKey = "server.writeTimeout" ServerPProfEnabledKey = "server.pprof.enabled" ServerRouterAlternativeBasePathKey = "server.router.alternativeBasePath" ServerRouterAlternativeBodyPathKey = "server.router.alternativeBodyPath" ServerRouterHTTPErrorCodeKey = "server.router.httpErrorCode" )
configuration constant
Variables ¶
View Source
var ( ValidLogLevels = []string{"debug", "info", "warn", "warning", "error", "fatal"} ValidLogFormats = []string{"text", "json"} ValidServerRouterHTTPErrorCodes = []int{200, 500} )
Functions ¶
func SetDefaultConfig ¶
func SetDefaultConfig(baseDir string)
SetDefaultConfig set default configuration, it is the lowest priority
func SetDefaultServer ¶
func SetDefaultServer(baseDir string)
SetDefaultServer sets the default value of server
func TrimSpaceOfArg ¶
TrimSpaceOfArg trims spaces of given argument
func ValidateConfig ¶
func ValidateConfig() (err error)
ValidateConfig validates if the configuration is valid
func ValidateDaemon ¶
func ValidateDaemon() error
ValidateDaemon validates if daemon section is valid
func ValidateServer ¶
func ValidateServer() error
ValidateServer validates if server section is valid
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.