Skip to content

Commit e05f015

Browse files
Andrew Farriesroboquat
authored andcommitted
Make server session secret configurable
Default to the existing default value, but allow the value to be overriden by a new experimental config value.
1 parent a3125cf commit e05f015

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

install/installer/pkg/components/server/configmap.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
4040
return nil
4141
})
4242

43+
sessionSecret := "Important!Really-Change-This-Key!"
44+
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
45+
if cfg.WebApp != nil && cfg.WebApp.Session.Secret != "" {
46+
sessionSecret = cfg.WebApp.Session.Secret
47+
}
48+
return nil
49+
})
50+
4351
// todo(sje): all these values are configurable
4452
scfg := ConfigSerialized{
4553
Version: ctx.VersionManifest.Version,
@@ -60,7 +68,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
6068
},
6169
Session: Session{
6270
MaxAgeMs: 259200000,
63-
Secret: "Important!Really-Change-This-Key!", // todo(sje): how best to do this?
71+
Secret: sessionSecret,
6472
},
6573
DefinitelyGpDisabled: ctx.Config.DisableDefinitelyGP,
6674
WorkspaceGarbageCollection: WorkspaceGarbageCollection{

install/installer/pkg/config/v1/experimental/experimental.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ type WebAppConfig struct {
5959
OAuthServer struct {
6060
JWTSecret string `json:"jwtSecret"`
6161
} `json:"oauthServer"`
62+
Session struct {
63+
Secret string `json:"secret"`
64+
} `json:"session"`
6265
}
6366

6467
type PublicAPIConfig struct {

0 commit comments

Comments
 (0)