Add global branding config field to control cookie banner default
Introduces a BRANDING boolean config (default true) propagated through the standard config pipeline. Cookie banners now initialize their show_branding column from this config instead of hardcoding true. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -66,6 +66,8 @@ spec:
|
||||
key: encryption-key
|
||||
- name: CHROME_DP_ADDR
|
||||
value: {{ include "probo.chrome.addr" . | quote }}
|
||||
- name: BRANDING
|
||||
value: {{ .Values.probo.branding | quote }}
|
||||
# API Configuration
|
||||
- name: API_ADDR
|
||||
value: ":{{ .Values.service.port }}"
|
||||
|
||||
@@ -196,6 +196,9 @@ probo:
|
||||
- "https://probo.example.com"
|
||||
- "http://probo.example.com"
|
||||
|
||||
# Show Probo branding on cookie banners
|
||||
branding: true
|
||||
|
||||
# Extra HTTP headers to add to responses
|
||||
extraHeaderFields: {}
|
||||
|
||||
|
||||
@@ -225,6 +225,7 @@ func (b *Builder) Build() (*probod.FullConfig, error) {
|
||||
ESign: probod.ESignConfig{
|
||||
TSAURL: b.getEnvOrDefault("ESIGN_TSA_URL", "http://timestamp.digicert.com"),
|
||||
},
|
||||
Branding: b.getEnvBoolOrDefault("BRANDING", true),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -207,6 +207,9 @@ func TestBuilder_Build_Defaults(t *testing.T) {
|
||||
// ESign config
|
||||
assert.Equal(t, "http://timestamp.digicert.com", cfg.Probod.ESign.TSAURL)
|
||||
|
||||
// Branding
|
||||
assert.True(t, cfg.Probod.Branding)
|
||||
|
||||
// No connectors by default
|
||||
assert.Empty(t, cfg.Probod.Connectors)
|
||||
}
|
||||
@@ -280,6 +283,8 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
||||
env["SCIM_BRIDGE_POLL_INTERVAL"] = "60"
|
||||
// ESign
|
||||
env["ESIGN_TSA_URL"] = "http://custom.tsa.example.com"
|
||||
// Branding
|
||||
env["BRANDING"] = "false"
|
||||
|
||||
b := NewBuilder(mockEnv(env))
|
||||
b.samlCertificate = "test-cert"
|
||||
@@ -361,6 +366,8 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
||||
assert.Equal(t, 60, cfg.Probod.SCIMBridge.PollInterval)
|
||||
// ESign
|
||||
assert.Equal(t, "http://custom.tsa.example.com", cfg.Probod.ESign.TSAURL)
|
||||
// Branding
|
||||
assert.False(t, cfg.Probod.Branding)
|
||||
}
|
||||
|
||||
func TestBuilder_Build_SlackConnector(t *testing.T) {
|
||||
|
||||
@@ -31,11 +31,12 @@ import (
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
pg *pg.Client
|
||||
pg *pg.Client
|
||||
showBranding bool
|
||||
}
|
||||
|
||||
func NewService(pgClient *pg.Client) *Service {
|
||||
return &Service{pg: pgClient}
|
||||
func NewService(pgClient *pg.Client, showBranding bool) *Service {
|
||||
return &Service{pg: pgClient, showBranding: showBranding}
|
||||
}
|
||||
|
||||
var defaultCategories = []struct {
|
||||
@@ -413,7 +414,7 @@ func (s *Service) CreateCookieBanner(
|
||||
PrivacyPolicyURL: req.PrivacyPolicyURL,
|
||||
ConsentExpiryDays: req.ConsentExpiryDays,
|
||||
ConsentMode: req.ConsentMode,
|
||||
ShowBranding: true,
|
||||
ShowBranding: s.showBranding,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ type (
|
||||
CustomDomains CustomDomainsConfig `json:"custom-domains"`
|
||||
SCIMBridge SCIMBridgeConfig `json:"scim-bridge"`
|
||||
ESign ESignConfig `json:"esign"`
|
||||
Branding bool `json:"branding"`
|
||||
}
|
||||
|
||||
// TrustCenterConfig contains trust center server configuration.
|
||||
@@ -223,6 +224,7 @@ func New() *Implm {
|
||||
ESign: ESignConfig{
|
||||
TSAURL: "http://timestamp.digicert.com",
|
||||
},
|
||||
Branding: true,
|
||||
EvidenceDescriber: EvidenceDescriberConfig{
|
||||
Interval: 10,
|
||||
StaleAfter: 300,
|
||||
@@ -517,7 +519,7 @@ func (impl *Implm) Run(
|
||||
|
||||
mailmanService := mailman.NewService(pgClient, fileManagerService, impl.cfg.Auth.Cookie.Secret, baseURL, impl.cfg.AWS.Bucket, encryptionKey, l)
|
||||
|
||||
cookieBannerService := cookiebanner.NewService(pgClient)
|
||||
cookieBannerService := cookiebanner.NewService(pgClient, impl.cfg.Branding)
|
||||
|
||||
proboService, err := probo.NewService(
|
||||
ctx,
|
||||
|
||||
Reference in New Issue
Block a user