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
|
psql -v ON_ERROR_STOP=1 -U $POSTGRES_USER -d probod <<-EOF
|
||||||
ALTER SCHEMA public OWNER TO probod;
|
ALTER SCHEMA public OWNER TO probod;
|
||||||
GRANT ALL ON SCHEMA public TO probod;
|
GRANT ALL ON SCHEMA public TO probod;
|
||||||
|
ALTER DATABASE probod SET probo.trust_center_base_domain TO 'probopage.localhost';
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
psql -v ON_ERROR_STOP=1 -U $POSTGRES_USER -d probod_test <<-EOF
|
psql -v ON_ERROR_STOP=1 -U $POSTGRES_USER -d probod_test <<-EOF
|
||||||
ALTER SCHEMA public OWNER TO probod;
|
ALTER SCHEMA public OWNER TO probod;
|
||||||
GRANT ALL ON SCHEMA public TO probod;
|
GRANT ALL ON SCHEMA public TO probod;
|
||||||
|
ALTER DATABASE probod_test SET probo.trust_center_base_domain TO 'probopage.localhost';
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ func (b *Builder) Build() (*probodconfig.FullConfig, error) {
|
|||||||
TrustCenter: probodconfig.TrustCenterConfig{
|
TrustCenter: probodconfig.TrustCenterConfig{
|
||||||
HTTPAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTP_ADDR"),
|
HTTPAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTP_ADDR"),
|
||||||
HTTPSAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTPS_ADDR"),
|
HTTPSAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTPS_ADDR"),
|
||||||
|
BaseDomain: b.resolver.getEnv("PROBOD_TRUST_CENTER_BASE_DOMAIN"),
|
||||||
ProxyProtocol: probodconfig.ProxyProtocolConfig{
|
ProxyProtocol: probodconfig.ProxyProtocolConfig{
|
||||||
TrustedProxies: b.parseOriginsList(b.resolver.getEnv("PROBOD_TRUST_CENTER_PROXY_PROTOCOL_TRUSTED_PROXIES")),
|
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
|
// Trust center config
|
||||||
assert.Empty(t, cfg.Probod.TrustCenter.HTTPAddr)
|
assert.Empty(t, cfg.Probod.TrustCenter.HTTPAddr)
|
||||||
assert.Empty(t, cfg.Probod.TrustCenter.HTTPSAddr)
|
assert.Empty(t, cfg.Probod.TrustCenter.HTTPSAddr)
|
||||||
|
assert.Empty(t, cfg.Probod.TrustCenter.BaseDomain)
|
||||||
assert.Nil(t, cfg.Probod.TrustCenter.ProxyProtocol.TrustedProxies)
|
assert.Nil(t, cfg.Probod.TrustCenter.ProxyProtocol.TrustedProxies)
|
||||||
|
|
||||||
// AWS config
|
// AWS config
|
||||||
@@ -335,6 +336,7 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
|||||||
// Trust center
|
// Trust center
|
||||||
env["PROBOD_TRUST_CENTER_HTTP_ADDR"] = ":8080"
|
env["PROBOD_TRUST_CENTER_HTTP_ADDR"] = ":8080"
|
||||||
env["PROBOD_TRUST_CENTER_HTTPS_ADDR"] = ":8443"
|
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"
|
env["PROBOD_TRUST_CENTER_PROXY_PROTOCOL_TRUSTED_PROXIES"] = "10.0.1.1,10.0.1.2"
|
||||||
// AWS
|
// AWS
|
||||||
env["PROBOD_AWS_REGION"] = "eu-west-1"
|
env["PROBOD_AWS_REGION"] = "eu-west-1"
|
||||||
@@ -469,6 +471,7 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
|||||||
// Trust center
|
// Trust center
|
||||||
assert.Equal(t, ":8080", cfg.Probod.TrustCenter.HTTPAddr)
|
assert.Equal(t, ":8080", cfg.Probod.TrustCenter.HTTPAddr)
|
||||||
assert.Equal(t, ":8443", cfg.Probod.TrustCenter.HTTPSAddr)
|
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)
|
assert.Equal(t, []string{"10.0.1.1", "10.0.1.2"}, cfg.Probod.TrustCenter.ProxyProtocol.TrustedProxies)
|
||||||
// AWS
|
// AWS
|
||||||
assert.Equal(t, "eu-west-1", cfg.Probod.AWS.Region)
|
assert.Equal(t, "eu-west-1", cfg.Probod.AWS.Region)
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ type (
|
|||||||
TrustCenterConfig struct {
|
TrustCenterConfig struct {
|
||||||
HTTPAddr string `json:"http-addr,omitempty"`
|
HTTPAddr string `json:"http-addr,omitempty"`
|
||||||
HTTPSAddr string `json:"https-addr,omitempty"`
|
HTTPSAddr string `json:"https-addr,omitempty"`
|
||||||
|
BaseDomain string `json:"base-domain,omitempty"`
|
||||||
ProxyProtocol ProxyProtocolConfig `json:"proxy-protocol,omitzero"`
|
ProxyProtocol ProxyProtocolConfig `json:"proxy-protocol,omitzero"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user