config: allow dynamic configuration of cookie settings (#1267)

This commit is contained in:
Caleb Doxsey 2020-08-13 08:11:34 -06:00 committed by GitHub
parent 0c51ad0e66
commit fbf5b403b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 184 additions and 165 deletions

View file

@ -23,18 +23,6 @@ import (
"github.com/pomerium/pomerium/pkg/grpc/databroker"
)
type atomicOptions struct {
value atomic.Value
}
func (a *atomicOptions) Load() *config.Options {
return a.value.Load().(*config.Options)
}
func (a *atomicOptions) Store(options *config.Options) {
a.value.Store(options)
}
type atomicMarshalUnmarshaler struct {
value atomic.Value
}
@ -52,7 +40,7 @@ type Authorize struct {
pe *evaluator.Evaluator
store *evaluator.Store
currentOptions atomicOptions
currentOptions *config.AtomicOptions
currentEncoder atomicMarshalUnmarshaler
templates *template.Template
@ -84,6 +72,7 @@ func New(opts *config.Options) (*Authorize, error) {
}
a := Authorize{
currentOptions: config.NewAtomicOptions(),
store: evaluator.NewStore(),
templates: template.Must(frontend.NewTemplates()),
dataBrokerClient: databroker.NewDataBrokerServiceClient(dataBrokerConn),
@ -99,7 +88,6 @@ func New(opts *config.Options) (*Authorize, error) {
return nil, err
}
a.currentEncoder.Store(encoder)
a.currentOptions.Store(new(config.Options))
return &a, nil
}