Skip to content

Commit

Permalink
Merge pull request #424 from freifunkMUC/bugfix/interface-not-cleaned…
Browse files Browse the repository at this point in the history
…-up-on-fatal-error

Gracefully terminates if configured OIDC auth server is not present on application start.
  • Loading branch information
nwaldispuehl committed Jul 16, 2023
2 parents bb80230 + 1c34bcd commit cc6d862
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cmd/serve/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ func (cmd *servecmd) Name() string {
}

func (cmd *servecmd) Run() {

// Swallow any panic stacktrace
defer func() {
if err := recover(); err != nil {
logrus.Fatal(err)
}
}()

conf := cmd.ReadConfig()

// Get the server's IP addresses within the VPN
Expand Down
2 changes: 1 addition & 1 deletion pkg/authnz/authconfig/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c *OIDCConfig) Provider() *authruntime.Provider {
ctx := context.Background()
provider, err := oidc.NewProvider(ctx, c.Issuer)
if err != nil {
logrus.Fatal(errors.Wrap(err, "failed to create OIDC provider"))
panic(errors.Wrap(err, "failed to create OIDC provider"))
}
verifier := provider.Verifier(&oidc.Config{ClientID: c.ClientID})

Expand Down

0 comments on commit cc6d862

Please sign in to comment.