From df7174a4151cd8c91d96aa7936466b774e81ef8d Mon Sep 17 00:00:00 2001 From: jay brown Date: Wed, 16 Apr 2025 12:38:31 -0700 Subject: [PATCH] cleanup --- internal/server/api/listener.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/server/api/listener.go b/internal/server/api/listener.go index d4a03d1d..0eca1ab6 100644 --- a/internal/server/api/listener.go +++ b/internal/server/api/listener.go @@ -40,7 +40,7 @@ type BaseConfig struct { } // GetConfigFromContext returns the config from the context. -// experimental since it is not used yet and may pose cylical dependency issues +// experimental since it is not used yet and may pose cyclical dependency issues // in handlers that are called by the generated // swagger code. This needs to be verified. //func GetConfigFromContext(ctx echo.Context) (Config, error) { @@ -198,9 +198,13 @@ func New(ctx context.Context, cfg Config) (*Server, error) { // Add config middleware before other middleware // so that the config is available to all middleware and handlers. + // If there are issues accessing this from a controller then just set the individual + // config values by name here as needed. You can also use the reflection method used in + // internal/serviceconfig/common.go printConfigRecursive() to copy all of the config values to + // the context by name. This would be guaranteed to be cycle free. e.Use(func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - c.Set(string(configContextKey), cfg) + c.Set(configContextKey, cfg) return next(c) } })