Adds API for interrogating current mode
It returns one of the following values: - gin. DebugMode - gin. ReleaseMode - gin. TestMode
This commit is contained in:
parent
d3249800e9
commit
fd2e342569
6
mode.go
6
mode.go
@ -22,6 +22,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var gin_mode int = debugCode
|
var gin_mode int = debugCode
|
||||||
|
var mode_name string = DebugMode
|
||||||
|
|
||||||
func SetMode(value string) {
|
func SetMode(value string) {
|
||||||
switch value {
|
switch value {
|
||||||
@ -34,6 +35,11 @@ func SetMode(value string) {
|
|||||||
default:
|
default:
|
||||||
panic("gin mode unknown, the allowed modes are: " + DebugMode + " and " + ReleaseMode)
|
panic("gin mode unknown, the allowed modes are: " + DebugMode + " and " + ReleaseMode)
|
||||||
}
|
}
|
||||||
|
mode_name = value
|
||||||
|
}
|
||||||
|
|
||||||
|
func Mode() string {
|
||||||
|
return mode_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
Loading…
Reference in New Issue
Block a user