Add trust center base domain configuration
Introduce the trust center base domain setting (default probopage.com) so managed default domains can be minted for every compliance page. This configuration is a prerequisite for the domain-ownership migration and the default-domain provisioning that happens at organization creation. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -15,9 +15,11 @@ EOF
|
||||
psql -v ON_ERROR_STOP=1 -U $POSTGRES_USER -d probod <<-EOF
|
||||
ALTER SCHEMA public OWNER TO probod;
|
||||
GRANT ALL ON SCHEMA public TO probod;
|
||||
ALTER DATABASE probod SET probo.trust_center_base_domain TO 'probopage.localhost';
|
||||
EOF
|
||||
|
||||
psql -v ON_ERROR_STOP=1 -U $POSTGRES_USER -d probod_test <<-EOF
|
||||
ALTER SCHEMA public OWNER TO probod;
|
||||
GRANT ALL ON SCHEMA public TO probod;
|
||||
ALTER DATABASE probod_test SET probo.trust_center_base_domain TO 'probopage.localhost';
|
||||
EOF
|
||||
|
||||
@@ -156,8 +156,9 @@ func (b *Builder) Build() (*probodconfig.FullConfig, error) {
|
||||
},
|
||||
},
|
||||
TrustCenter: probodconfig.TrustCenterConfig{
|
||||
HTTPAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTP_ADDR"),
|
||||
HTTPSAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTPS_ADDR"),
|
||||
HTTPAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTP_ADDR"),
|
||||
HTTPSAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTPS_ADDR"),
|
||||
BaseDomain: b.resolver.getEnv("PROBOD_TRUST_CENTER_BASE_DOMAIN"),
|
||||
ProxyProtocol: probodconfig.ProxyProtocolConfig{
|
||||
TrustedProxies: b.parseOriginsList(b.resolver.getEnv("PROBOD_TRUST_CENTER_PROXY_PROTOCOL_TRUSTED_PROXIES")),
|
||||
},
|
||||
|
||||
@@ -190,6 +190,7 @@ func TestBuilder_Build_Defaults(t *testing.T) {
|
||||
// Trust center config
|
||||
assert.Empty(t, cfg.Probod.TrustCenter.HTTPAddr)
|
||||
assert.Empty(t, cfg.Probod.TrustCenter.HTTPSAddr)
|
||||
assert.Empty(t, cfg.Probod.TrustCenter.BaseDomain)
|
||||
assert.Nil(t, cfg.Probod.TrustCenter.ProxyProtocol.TrustedProxies)
|
||||
|
||||
// AWS config
|
||||
@@ -335,6 +336,7 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
||||
// Trust center
|
||||
env["PROBOD_TRUST_CENTER_HTTP_ADDR"] = ":8080"
|
||||
env["PROBOD_TRUST_CENTER_HTTPS_ADDR"] = ":8443"
|
||||
env["PROBOD_TRUST_CENTER_BASE_DOMAIN"] = "probopage.example.com"
|
||||
env["PROBOD_TRUST_CENTER_PROXY_PROTOCOL_TRUSTED_PROXIES"] = "10.0.1.1,10.0.1.2"
|
||||
// AWS
|
||||
env["PROBOD_AWS_REGION"] = "eu-west-1"
|
||||
@@ -469,6 +471,7 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
||||
// Trust center
|
||||
assert.Equal(t, ":8080", cfg.Probod.TrustCenter.HTTPAddr)
|
||||
assert.Equal(t, ":8443", cfg.Probod.TrustCenter.HTTPSAddr)
|
||||
assert.Equal(t, "probopage.example.com", cfg.Probod.TrustCenter.BaseDomain)
|
||||
assert.Equal(t, []string{"10.0.1.1", "10.0.1.2"}, cfg.Probod.TrustCenter.ProxyProtocol.TrustedProxies)
|
||||
// AWS
|
||||
assert.Equal(t, "eu-west-1", cfg.Probod.AWS.Region)
|
||||
|
||||
@@ -83,6 +83,7 @@ type (
|
||||
TrustCenterConfig struct {
|
||||
HTTPAddr string `json:"http-addr,omitempty"`
|
||||
HTTPSAddr string `json:"https-addr,omitempty"`
|
||||
BaseDomain string `json:"base-domain,omitempty"`
|
||||
ProxyProtocol ProxyProtocolConfig `json:"proxy-protocol,omitzero"`
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user