From 3808a617958bbec011824efb4cb2fe05c93620e4 Mon Sep 17 00:00:00 2001 From: Eleftheria Stein-Kousathana Date: Fri, 22 Dec 2023 14:14:01 +0100 Subject: [PATCH] Add flag for identity server base URL Fix #1665 --- cmd/server/app/root.go | 3 +++ docker-compose.yaml | 1 + internal/config/identity.go | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/cmd/server/app/root.go b/cmd/server/app/root.go index af78cf4830..46bc58d8c4 100644 --- a/cmd/server/app/root.go +++ b/cmd/server/app/root.go @@ -57,6 +57,9 @@ func init() { if err := auth.RegisterOAuthFlags(viper.GetViper(), RootCmd.PersistentFlags()); err != nil { log.Fatal().Err(err).Msg("Error registering oauth flags") } + if err := config.RegisterIdentityFlags(viper.GetViper(), RootCmd.PersistentFlags()); err != nil { + log.Fatal().Err(err).Msg("Error registering identity flags") + } } func initConfig() { diff --git a/docker-compose.yaml b/docker-compose.yaml index 8c6737b818..14ea591ba2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -25,6 +25,7 @@ services: "--http-host=0.0.0.0", "--metric-host=0.0.0.0", "--db-host=postgres", + "--issuer-url=http://keycloak:8080", "--config=/app/server-config.yaml", # If you don't want to store your GitHub client ID and secret in the main # config file, point to them here: diff --git a/internal/config/identity.go b/internal/config/identity.go index ef6fdefcac..825da65a27 100644 --- a/internal/config/identity.go +++ b/internal/config/identity.go @@ -19,6 +19,9 @@ import ( "fmt" "os" "path/filepath" + + "github.com/spf13/pflag" + "github.com/spf13/viper" ) // IdentityConfig is the configuration for the identity provider @@ -49,3 +52,9 @@ func (sic *ServerIdentityConfig) GetClientSecret() (string, error) { } return sic.ClientSecret, nil } + +// RegisterIdentityFlags registers the flags for the identity server +func RegisterIdentityFlags(v *viper.Viper, flags *pflag.FlagSet) error { + return BindConfigFlag(v, flags, "identity.server.issuer_url", "issuer-url", "", + "The base URL where the identity server is running", flags.String) +}