mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-14 09:37:50 +02:00
postgres: registry support (#3454)
This commit is contained in:
parent
ca8db7b619
commit
24a9d627cd
9 changed files with 436 additions and 36 deletions
|
@ -4,10 +4,14 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const defaultExpiry = time.Hour * 24
|
||||
const (
|
||||
defaultExpiry = time.Hour * 24
|
||||
defaultRegistryTTL = time.Second * 30
|
||||
)
|
||||
|
||||
type config struct {
|
||||
expiry time.Duration
|
||||
expiry time.Duration
|
||||
registryTTL time.Duration
|
||||
}
|
||||
|
||||
// Option customizes a Backend.
|
||||
|
@ -20,9 +24,17 @@ func WithExpiry(expiry time.Duration) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithRegistryTTL sets the default registry TTL.
|
||||
func WithRegistryTTL(ttl time.Duration) Option {
|
||||
return func(cfg *config) {
|
||||
cfg.registryTTL = ttl
|
||||
}
|
||||
}
|
||||
|
||||
func getConfig(options ...Option) *config {
|
||||
cfg := new(config)
|
||||
WithExpiry(defaultExpiry)(cfg)
|
||||
WithRegistryTTL(defaultRegistryTTL)(cfg)
|
||||
for _, o := range options {
|
||||
o(cfg)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue