Skip to content

Commit

Permalink
Add flag for identity server base URL (#2033)
Browse files Browse the repository at this point in the history
Fix #1665
  • Loading branch information
eleftherias authored Dec 22, 2023
1 parent bb3812c commit 71eb295
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/server/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions internal/config/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

0 comments on commit 71eb295

Please sign in to comment.