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
|
key: encryption-key
|
||||||
- name: CHROME_DP_ADDR
|
- name: CHROME_DP_ADDR
|
||||||
value: {{ include "probo.chrome.addr" . | quote }}
|
value: {{ include "probo.chrome.addr" . | quote }}
|
||||||
|
- name: BRANDING
|
||||||
|
value: {{ .Values.probo.branding | quote }}
|
||||||
# API Configuration
|
# API Configuration
|
||||||
- name: API_ADDR
|
- name: API_ADDR
|
||||||
value: ":{{ .Values.service.port }}"
|
value: ":{{ .Values.service.port }}"
|
||||||
|
|||||||
@@ -196,6 +196,9 @@ probo:
|
|||||||
- "https://probo.example.com"
|
- "https://probo.example.com"
|
||||||
- "http://probo.example.com"
|
- "http://probo.example.com"
|
||||||
|
|
||||||
|
# Show Probo branding on cookie banners
|
||||||
|
branding: true
|
||||||
|
|
||||||
# Extra HTTP headers to add to responses
|
# Extra HTTP headers to add to responses
|
||||||
extraHeaderFields: {}
|
extraHeaderFields: {}
|
||||||
|
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ func (b *Builder) Build() (*probod.FullConfig, error) {
|
|||||||
ESign: probod.ESignConfig{
|
ESign: probod.ESignConfig{
|
||||||
TSAURL: b.getEnvOrDefault("ESIGN_TSA_URL", "http://timestamp.digicert.com"),
|
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
|
// ESign config
|
||||||
assert.Equal(t, "http://timestamp.digicert.com", cfg.Probod.ESign.TSAURL)
|
assert.Equal(t, "http://timestamp.digicert.com", cfg.Probod.ESign.TSAURL)
|
||||||
|
|
||||||
|
// Branding
|
||||||
|
assert.True(t, cfg.Probod.Branding)
|
||||||
|
|
||||||
// No connectors by default
|
// No connectors by default
|
||||||
assert.Empty(t, cfg.Probod.Connectors)
|
assert.Empty(t, cfg.Probod.Connectors)
|
||||||
}
|
}
|
||||||
@@ -280,6 +283,8 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
|||||||
env["SCIM_BRIDGE_POLL_INTERVAL"] = "60"
|
env["SCIM_BRIDGE_POLL_INTERVAL"] = "60"
|
||||||
// ESign
|
// ESign
|
||||||
env["ESIGN_TSA_URL"] = "http://custom.tsa.example.com"
|
env["ESIGN_TSA_URL"] = "http://custom.tsa.example.com"
|
||||||
|
// Branding
|
||||||
|
env["BRANDING"] = "false"
|
||||||
|
|
||||||
b := NewBuilder(mockEnv(env))
|
b := NewBuilder(mockEnv(env))
|
||||||
b.samlCertificate = "test-cert"
|
b.samlCertificate = "test-cert"
|
||||||
@@ -361,6 +366,8 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
|||||||
assert.Equal(t, 60, cfg.Probod.SCIMBridge.PollInterval)
|
assert.Equal(t, 60, cfg.Probod.SCIMBridge.PollInterval)
|
||||||
// ESign
|
// ESign
|
||||||
assert.Equal(t, "http://custom.tsa.example.com", cfg.Probod.ESign.TSAURL)
|
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) {
|
func TestBuilder_Build_SlackConnector(t *testing.T) {
|
||||||
|
|||||||
@@ -32,10 +32,11 @@ import (
|
|||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
pg *pg.Client
|
pg *pg.Client
|
||||||
|
showBranding bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewService(pgClient *pg.Client) *Service {
|
func NewService(pgClient *pg.Client, showBranding bool) *Service {
|
||||||
return &Service{pg: pgClient}
|
return &Service{pg: pgClient, showBranding: showBranding}
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultCategories = []struct {
|
var defaultCategories = []struct {
|
||||||
@@ -413,7 +414,7 @@ func (s *Service) CreateCookieBanner(
|
|||||||
PrivacyPolicyURL: req.PrivacyPolicyURL,
|
PrivacyPolicyURL: req.PrivacyPolicyURL,
|
||||||
ConsentExpiryDays: req.ConsentExpiryDays,
|
ConsentExpiryDays: req.ConsentExpiryDays,
|
||||||
ConsentMode: req.ConsentMode,
|
ConsentMode: req.ConsentMode,
|
||||||
ShowBranding: true,
|
ShowBranding: s.showBranding,
|
||||||
CreatedAt: now,
|
CreatedAt: now,
|
||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ type (
|
|||||||
CustomDomains CustomDomainsConfig `json:"custom-domains"`
|
CustomDomains CustomDomainsConfig `json:"custom-domains"`
|
||||||
SCIMBridge SCIMBridgeConfig `json:"scim-bridge"`
|
SCIMBridge SCIMBridgeConfig `json:"scim-bridge"`
|
||||||
ESign ESignConfig `json:"esign"`
|
ESign ESignConfig `json:"esign"`
|
||||||
|
Branding bool `json:"branding"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TrustCenterConfig contains trust center server configuration.
|
// TrustCenterConfig contains trust center server configuration.
|
||||||
@@ -223,6 +224,7 @@ func New() *Implm {
|
|||||||
ESign: ESignConfig{
|
ESign: ESignConfig{
|
||||||
TSAURL: "http://timestamp.digicert.com",
|
TSAURL: "http://timestamp.digicert.com",
|
||||||
},
|
},
|
||||||
|
Branding: true,
|
||||||
EvidenceDescriber: EvidenceDescriberConfig{
|
EvidenceDescriber: EvidenceDescriberConfig{
|
||||||
Interval: 10,
|
Interval: 10,
|
||||||
StaleAfter: 300,
|
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)
|
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(
|
proboService, err := probo.NewService(
|
||||||
ctx,
|
ctx,
|
||||||
|
|||||||
Reference in New Issue
Block a user