Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
d-g-town committed May 6, 2024
1 parent d9e3286 commit a6b17e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions api/server/shared/config/env/envconfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 7 additions & 3 deletions api/server/shared/config/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions zarf/helm/.serverenv
Original file line number Diff line number Diff line change
Expand Up @@ -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=

0 comments on commit a6b17e1

Please sign in to comment.