mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-19 09:38:03 +02:00
config: add runtime flags
This commit is contained in:
parent
84b44ae2e6
commit
be9c14fc04
13 changed files with 486 additions and 212 deletions
26
config/runtime_flags.go
Normal file
26
config/runtime_flags.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package config
|
||||
|
||||
// GRPCDatabrokerKeepalive enables gRPC keepalive to the databroker service
|
||||
var GRPCDatabrokerKeepalive = runtimeFlag("grpc_databroker_keepalive", false)
|
||||
|
||||
// RuntimeFlag is a runtime flag that can flip on/off certain features
|
||||
type RuntimeFlag string
|
||||
|
||||
// RuntimeFlags is a map of runtime flags
|
||||
type RuntimeFlags map[RuntimeFlag]bool
|
||||
|
||||
func runtimeFlag(txt string, def bool) RuntimeFlag {
|
||||
key := RuntimeFlag(txt)
|
||||
defaultRuntimeFlags[key] = def
|
||||
return key
|
||||
}
|
||||
|
||||
var defaultRuntimeFlags = map[RuntimeFlag]bool{}
|
||||
|
||||
func DefaultRuntimeFlags() RuntimeFlags {
|
||||
out := make(RuntimeFlags, len(defaultRuntimeFlags))
|
||||
for k, v := range defaultRuntimeFlags {
|
||||
out[k] = v
|
||||
}
|
||||
return out
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue