Skip to content

Commit

Permalink
feat: Support for setting session path
Browse files Browse the repository at this point in the history
  • Loading branch information
langecode committed Aug 29, 2023
1 parent 2abdcd3 commit 62d0f53
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
redirectURL = "redirectURL"
providers = "providers"
upstreams = "upstreams"
sessionPath = "sessionPath"
)

type provider struct {
Expand Down Expand Up @@ -66,7 +67,7 @@ var (
if err != nil {
return err
}
fs := sessions.NewFilesystemStore("", hashKey, blockKey)
fs := sessions.NewFilesystemStore(viper.GetString(sessionPath), hashKey, blockKey)
fs.MaxLength(0)
e.Use(session.Middleware(fs))

Expand Down Expand Up @@ -162,6 +163,11 @@ func init() {
_ = viper.BindPFlag(redirectURL, rootCmd.Flags().Lookup("redirect-url"))
_ = viper.BindEnv(redirectURL, "REDIRECT_URL")

rootCmd.Flags().String("session-path", "", "Path to store encrypted session data (SESSION_PATH)")
_ = viper.BindPFlag(sessionPath, rootCmd.Flags().Lookup("session-path"))
_ = viper.BindEnv(redirectURL, "SESSION_PATH")
viper.SetDefault(sessionPath, "")

viper.SetConfigName("config")
viper.SetConfigType("yaml")
viper.AddConfigPath(".")
Expand Down

0 comments on commit 62d0f53

Please sign in to comment.