Skip to content

Commit

Permalink
put a warning if not using any of the persistent backends (pomerium#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
wasaga authored Nov 10, 2022
1 parent c38efee commit c884fdb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pomerium/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func applyConfig(ctx context.Context, p *pb.Config, c *model.Config) error {
{"idp secret", applyIDPSecret},
{"idp request params", applyIDPRequestParams},
{"cookie", applyCookie},
{"warnings", checkForWarnings},
{"jwt claim headers", applyJWTClaimHeaders},
} {
if err := apply.fn(ctx, p, c); err != nil {
Expand All @@ -45,6 +46,18 @@ func applyConfig(ctx context.Context, p *pb.Config, c *model.Config) error {
return nil
}

func checkForWarnings(ctx context.Context, _ *pb.Config, c *model.Config) error {
if c.Spec.Storage == nil || (c.Spec.Storage.Redis == nil && c.Spec.Storage.Postgres == nil) {
util.Add(ctx, config.FieldMsg{
Key: "storage",
DocsURL: "https://www.pomerium.com/docs/topics/data-storage#persistence",
FieldCheckMsg: "please specify a persistent storage backend",
KeyAction: config.KeyActionWarn,
})
}
return nil
}

func applyJWTClaimHeaders(_ context.Context, p *pb.Config, c *model.Config) error {
p.Settings.JwtClaimsHeaders = c.Spec.JWTClaimHeaders
return nil
Expand Down Expand Up @@ -126,7 +139,7 @@ func applyIDPSecret(ctx context.Context, p *pb.Config, c *model.Config) error {
}

if _, ok := c.IdpSecret.Data["service_account"]; ok {
util.Add[config.FieldMsg](ctx, config.FieldMsg{
util.Add(ctx, config.FieldMsg{
Key: "identityProvider.secret.service_account",
DocsURL: "https://docs.pomerium.com/docs/overview/upgrading#idp-directory-sync",
FieldCheckMsg: config.FieldCheckMsgRemoved,
Expand Down

0 comments on commit c884fdb

Please sign in to comment.