From a6b17e145f374d2802b04dcd869e7512f3a3f118 Mon Sep 17 00:00:00 2001 From: dgtown Date: Mon, 6 May 2024 13:33:25 -0400 Subject: [PATCH] address comments --- api/server/shared/config/env/envconfs.go | 5 +++-- api/server/shared/config/loader/loader.go | 10 +++++++--- zarf/helm/.serverenv | 7 ++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/api/server/shared/config/env/envconfs.go b/api/server/shared/config/env/envconfs.go index b9b8c783b9..3003a4accc 100644 --- a/api/server/shared/config/env/envconfs.go +++ b/api/server/shared/config/env/envconfs.go @@ -170,8 +170,9 @@ type ServerConf struct { // TelemetryCollectorURL is the URL (host:port) for collecting spans TelemetryCollectorURL string `env:"TELEMETRY_COLLECTOR_URL,default=localhost:4317"` - OryUrl string `env:"ORY_URL,default=http://localhost:4000"` - OryApiKey string `env:"ORY_API_KEY"` + OryEnabled bool `env:"ORY_ENABLED,default=false"` + OryUrl string `env:"ORY_URL,default=http://localhost:4000"` + OryApiKey string `env:"ORY_API_KEY"` } // DBConf is the database configuration: if generated from environment variables, diff --git a/api/server/shared/config/loader/loader.go b/api/server/shared/config/loader/loader.go index 792ac56a4d..17b6f1b8b9 100644 --- a/api/server/shared/config/loader/loader.go +++ b/api/server/shared/config/loader/loader.go @@ -396,9 +396,13 @@ func (e *EnvConfigLoader) LoadConfig() (res *config.Config, err error) { URL: InstanceEnvConf.ServerConf.OryUrl, }} - res.Ory = *ory.NewAPIClient(c) - res.OryApiKeyContextWrapper = func(ctx context.Context) context.Context { - return context.WithValue(ctx, ory.ContextAccessToken, InstanceEnvConf.ServerConf.OryApiKey) + if InstanceEnvConf.ServerConf.OryEnabled { + res.Logger.Info().Msg("Creating Ory client") + res.Ory = *ory.NewAPIClient(c) + res.OryApiKeyContextWrapper = func(ctx context.Context) context.Context { + return context.WithValue(ctx, ory.ContextAccessToken, InstanceEnvConf.ServerConf.OryApiKey) + } + res.Logger.Info().Msg("Created Ory client") } return res, nil diff --git a/zarf/helm/.serverenv b/zarf/helm/.serverenv index 08c8455848..ab36932880 100644 --- a/zarf/helm/.serverenv +++ b/zarf/helm/.serverenv @@ -94,8 +94,9 @@ NEON_CLIENT_ID= # NEON_CLIENT_SECRET is used to integrate with Neon NEON_CLIENT_SECRET= -// Note: Ory values can be found in 1Password -// ORY_URL is the URL for Ory +# ORY_ENABLED is used to enable the Ory integration +ORY_ENABLED=false +# ORY_URL is the URL for Ory; can be found in 1Password ORY_URL= -// ORY_API_KEY authenticates with Ory +# ORY_API_KEY authenticates with Ory; can be found in 1Password ORY_API_KEY=