mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-03 03:12:50 +02:00
mcp: storage scaffolding (#5581)
This commit is contained in:
parent
f1a9401ddc
commit
db221cb826
4 changed files with 68 additions and 8 deletions
|
@ -64,7 +64,7 @@ type Proxy struct {
|
|||
webauthn *webauthn.Handler
|
||||
tracerProvider oteltrace.TracerProvider
|
||||
logoProvider portal.LogoProvider
|
||||
mcp *mcp.Handler
|
||||
mcp *atomicutil.Value[*mcp.Handler]
|
||||
}
|
||||
|
||||
// New takes a Proxy service from options and a validation function.
|
||||
|
@ -87,7 +87,7 @@ func New(ctx context.Context, cfg *config.Config) (*Proxy, error) {
|
|||
currentConfig: atomicutil.NewValue(&config.Config{Options: config.NewDefaultOptions()}),
|
||||
currentRouter: atomicutil.NewValue(httputil.NewRouter()),
|
||||
logoProvider: portal.NewLogoProvider(),
|
||||
mcp: mcp,
|
||||
mcp: atomicutil.NewValue(mcp),
|
||||
}
|
||||
p.OnConfigChange(ctx, cfg)
|
||||
p.webauthn = webauthn.New(p.getWebauthnState)
|
||||
|
@ -110,6 +110,13 @@ func (p *Proxy) OnConfigChange(ctx context.Context, cfg *config.Config) {
|
|||
return
|
||||
}
|
||||
|
||||
mcp, err := mcp.New(ctx, mcp.DefaultPrefix, cfg)
|
||||
if err != nil {
|
||||
log.Ctx(ctx).Error().Err(err).Msg("proxy: failed to update proxy state from configuration settings")
|
||||
} else {
|
||||
p.mcp.Store(mcp)
|
||||
}
|
||||
|
||||
p.currentConfig.Store(cfg)
|
||||
if err := p.setHandlers(ctx, cfg.Options); err != nil {
|
||||
log.Ctx(ctx).Error().Err(err).Msg("proxy: failed to update proxy handlers from configuration settings")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue