Skip to content

Commit

Permalink
Add check if session secret is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Planlos5000 committed Dec 18, 2024
1 parent 6812942 commit 1b2b0f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ func main() {
Usage: "JWT claim to request for the user name",
Value: "profile",
}),
altsrc.NewStringFlag(&cli.StringFlag{
Name: "session-secret",
EnvVars: []string{"SESSION_SECRET"},
Usage: "Session secret for the authentication provider. Must be provided if an authentication provider is used.",
Required: false,
}),
altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "verbose",
Aliases: []string{"v"},
Expand Down Expand Up @@ -341,6 +347,10 @@ func run(c *cli.Context) error {
}
}

if c.String("session-secret") == "" && len(providersMap) != 0 {
return errors.New("you may not start the application without a session secret if an authentication provider is configured")
}

dbConnection := database.New(db, c.Bool("verbose"))

keyWithNewlines := strings.ReplaceAll(c.String("key"), "\\n", "\n")
Expand Down

0 comments on commit 1b2b0f6

Please sign in to comment.