Added environment variables support (WIP)

This commit is contained in:
David J. Allen 2024-05-03 20:20:06 -06:00
parent 2413ab2766
commit e791a01ea2
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
2 changed files with 100 additions and 2 deletions

View file

@ -22,6 +22,9 @@ var serveCmd = &cobra.Command{
s := opaal.NewServerWithConfig(&config)
// FIXME: change how the server address is set with `NewServerWithConfig`
s.Server.Addr = fmt.Sprintf("%s:%d", s.Issuer.Host, s.Issuer.Port)
if config.Options.Verbose {
fmt.Printf("Identity provider listening on %s\n", s.Server.Addr)
}
err := s.StartIdentityProvider()
if errors.Is(err, http.ErrServerClosed) {
fmt.Printf("Identity provider server closed.\n")
@ -32,6 +35,8 @@ var serveCmd = &cobra.Command{
}
func init() {
serveCmd.Flags().StringVar(&config.Server.Issuer.Host, "host", "127.0.0.1", "set the identity provider host")
serveCmd.Flags().IntVar(&config.Server.Issuer.Port, "port", 3332, "set the identity provider port")
serveCmd.Flags().StringVar(&endpoints.Authorization, "endpoints.authorization", "", "set the authorization endpoint for the identity provider")
serveCmd.Flags().StringVar(&endpoints.Token, "endpoints.token", "", "set the token endpoint for the identity provider")
serveCmd.Flags().StringVar(&endpoints.JwksUri, "endpoints.jwks_uri", "", "set the JWKS endpoints for the identity provider")