25 lines
377 B
Go
25 lines
377 B
Go
package contexts
|
|
|
|
import "context"
|
|
|
|
type Key string
|
|
|
|
func (c Key) String() string {
|
|
return "oslstats context key " + string(c)
|
|
}
|
|
|
|
var DevModeKey Key = Key("devmode")
|
|
|
|
func DevMode(ctx context.Context) DevInfo {
|
|
devmode, ok := ctx.Value(DevModeKey).(DevInfo)
|
|
if !ok {
|
|
return DevInfo{}
|
|
}
|
|
return devmode
|
|
}
|
|
|
|
type DevInfo struct {
|
|
WebsocketBase string
|
|
HTMXLog bool
|
|
}
|