mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 16:30:17 +02:00
log context (#2107)
This commit is contained in:
parent
e7995954ff
commit
e0c09a0998
87 changed files with 714 additions and 524 deletions
|
@ -5,6 +5,7 @@
|
|||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
|
@ -76,17 +77,17 @@ func New(cfg *config.Config) (*Proxy, error) {
|
|||
}
|
||||
|
||||
// OnConfigChange updates internal structures based on config.Options
|
||||
func (p *Proxy) OnConfigChange(cfg *config.Config) {
|
||||
func (p *Proxy) OnConfigChange(ctx context.Context, cfg *config.Config) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
|
||||
p.currentOptions.Store(cfg.Options)
|
||||
if err := p.setHandlers(cfg.Options); err != nil {
|
||||
log.Error().Err(err).Msg("proxy: failed to update proxy handlers from configuration settings")
|
||||
log.Error(context.TODO()).Err(err).Msg("proxy: failed to update proxy handlers from configuration settings")
|
||||
}
|
||||
if state, err := newProxyStateFromConfig(cfg); err != nil {
|
||||
log.Error().Err(err).Msg("proxy: failed to update proxy state from configuration settings")
|
||||
log.Error(context.TODO()).Err(err).Msg("proxy: failed to update proxy state from configuration settings")
|
||||
} else {
|
||||
p.state.Store(state)
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ func (p *Proxy) OnConfigChange(cfg *config.Config) {
|
|||
|
||||
func (p *Proxy) setHandlers(opts *config.Options) error {
|
||||
if len(opts.GetAllPolicies()) == 0 {
|
||||
log.Warn().Msg("proxy: configuration has no policies")
|
||||
log.Warn(context.TODO()).Msg("proxy: configuration has no policies")
|
||||
}
|
||||
r := httputil.NewRouter()
|
||||
r.NotFoundHandler = httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue