Skip to content

Commit

Permalink
component: enable setting nil and several fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Sep 10, 2019
1 parent 4184472 commit f9804f8
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 50 deletions.
32 changes: 16 additions & 16 deletions pkg/3scale/amp/component/backend_options_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,36 @@ func (m *BackendOptionsBuilder) WildcardDomain(wildcardDomain string) {
m.options.wildcardDomain = wildcardDomain
}

func (m *BackendOptionsBuilder) ListenerServiceEndpoint(serviceEndpoint string) {
m.options.serviceEndpoint = &serviceEndpoint
func (m *BackendOptionsBuilder) ListenerServiceEndpoint(serviceEndpoint *string) {
m.options.serviceEndpoint = serviceEndpoint
}

func (m *BackendOptionsBuilder) ListenerRouteEndpoint(routeEndpoint string) {
m.options.routeEndpoint = &routeEndpoint
func (m *BackendOptionsBuilder) ListenerRouteEndpoint(routeEndpoint *string) {
m.options.routeEndpoint = routeEndpoint
}

func (m *BackendOptionsBuilder) RedisStorageURL(url string) {
m.options.storageURL = &url
func (m *BackendOptionsBuilder) RedisStorageURL(url *string) {
m.options.storageURL = url
}

func (m *BackendOptionsBuilder) RedisQueuesURL(url string) {
m.options.queuesURL = &url
func (m *BackendOptionsBuilder) RedisQueuesURL(url *string) {
m.options.queuesURL = url
}

func (m *BackendOptionsBuilder) RedisStorageSentinelHosts(hosts string) {
m.options.storageSentinelHosts = &hosts
func (m *BackendOptionsBuilder) RedisStorageSentinelHosts(hosts *string) {
m.options.storageSentinelHosts = hosts
}

func (m *BackendOptionsBuilder) RedisStorageSentinelRole(role string) {
m.options.storageSentinelRole = &role
func (m *BackendOptionsBuilder) RedisStorageSentinelRole(role *string) {
m.options.storageSentinelRole = role
}

func (m *BackendOptionsBuilder) RedisQueuesSentinelHosts(hosts string) {
m.options.queuesSentinelHosts = &hosts
func (m *BackendOptionsBuilder) RedisQueuesSentinelHosts(hosts *string) {
m.options.queuesSentinelHosts = hosts
}

func (m *BackendOptionsBuilder) RedisQueuesSentinelRole(role string) {
m.options.queuesSentinelRole = &role
func (m *BackendOptionsBuilder) RedisQueuesSentinelRole(role *string) {
m.options.queuesSentinelRole = role
}

func (m *BackendOptionsBuilder) ListenerResourceRequirements(resourceRequirements v1.ResourceRequirements) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/3scale/amp/component/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (system *System) buildSystemBaseEnv() []v1.EnvVar {
smtpEnvConfigMapEnvs := system.getSystemSmtpEnvsFromSMTPConfigMap()
result = append(result, smtpEnvConfigMapEnvs...)

apicastAccessToken := envVarFromSecret("APICAST_ACCESS_TOKEN", "system-master-apicast", "ACCESS_TOKEN")
apicastAccessToken := envVarFromSecret("APICAST_ACCESS_TOKEN", SystemSecretSystemMasterApicastSecretName, "ACCESS_TOKEN")
result = append(result, apicastAccessToken)

// Add zync secret to envvars sources
Expand Down
52 changes: 26 additions & 26 deletions pkg/3scale/amp/component/system_options_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func (s *SystemOptionsBuilder) AdminUsername(adminUsername string) {
s.options.adminUsername = adminUsername
}

func (s *SystemOptionsBuilder) AdminEmail(adminEmail string) {
s.options.adminEmail = &adminEmail
func (s *SystemOptionsBuilder) AdminEmail(adminEmail *string) {
s.options.adminEmail = adminEmail
}

func (s *SystemOptionsBuilder) AmpRelease(ampRelease string) {
Expand Down Expand Up @@ -148,52 +148,52 @@ func (s *SystemOptionsBuilder) StorageClassName(storageClassName *string) {
s.options.storageClassName = storageClassName
}

func (s *SystemOptionsBuilder) MemcachedServers(servers string) {
s.options.memcachedServers = &servers
func (s *SystemOptionsBuilder) MemcachedServers(servers *string) {
s.options.memcachedServers = servers
}

func (s *SystemOptionsBuilder) EventHooksURL(eventHooksURL string) {
s.options.eventHooksURL = &eventHooksURL
func (s *SystemOptionsBuilder) EventHooksURL(eventHooksURL *string) {
s.options.eventHooksURL = eventHooksURL
}

func (s *SystemOptionsBuilder) RedisURL(redisURL string) {
s.options.redisURL = &redisURL
func (s *SystemOptionsBuilder) RedisURL(redisURL *string) {
s.options.redisURL = redisURL
}

func (s *SystemOptionsBuilder) RedisSentinelHosts(hosts string) {
s.options.redisSentinelHosts = &hosts
func (s *SystemOptionsBuilder) RedisSentinelHosts(hosts *string) {
s.options.redisSentinelHosts = hosts
}

func (s *SystemOptionsBuilder) RedisSentinelRole(role string) {
s.options.redisSentinelRole = &role
func (s *SystemOptionsBuilder) RedisSentinelRole(role *string) {
s.options.redisSentinelRole = role
}

func (s *SystemOptionsBuilder) MessageBusRedisURL(url string) {
s.options.messageBusRedisURL = &url
func (s *SystemOptionsBuilder) MessageBusRedisURL(url *string) {
s.options.messageBusRedisURL = url
}

func (s *SystemOptionsBuilder) MessageBusRedisSentinelHosts(hosts string) {
s.options.messageBusRedisSentinelHosts = &hosts
func (s *SystemOptionsBuilder) MessageBusRedisSentinelHosts(hosts *string) {
s.options.messageBusRedisSentinelHosts = hosts
}

func (s *SystemOptionsBuilder) MessageBusRedisSentinelRole(role string) {
s.options.messageBusRedisSentinelRole = &role
func (s *SystemOptionsBuilder) MessageBusRedisSentinelRole(role *string) {
s.options.messageBusRedisSentinelRole = role
}

func (s *SystemOptionsBuilder) RedisNamespace(namespace string) {
s.options.redisNamespace = &namespace
func (s *SystemOptionsBuilder) RedisNamespace(namespace *string) {
s.options.redisNamespace = namespace
}

func (s *SystemOptionsBuilder) MessageBusRedisNamespace(namespace string) {
s.options.messageBusRedisNamespace = &namespace
func (s *SystemOptionsBuilder) MessageBusRedisNamespace(namespace *string) {
s.options.messageBusRedisNamespace = namespace
}

func (s *SystemOptionsBuilder) ApicastSystemMasterProxyConfigEndpoint(endpoint string) {
s.options.apicastSystemMasterProxyConfigEndpoint = &endpoint
func (s *SystemOptionsBuilder) ApicastSystemMasterProxyConfigEndpoint(endpoint *string) {
s.options.apicastSystemMasterProxyConfigEndpoint = endpoint
}

func (s *SystemOptionsBuilder) ApicastSystemMasterBaseURL(url string) {
s.options.apicastSystemMasterBaseURL = &url
func (s *SystemOptionsBuilder) ApicastSystemMasterBaseURL(url *string) {
s.options.apicastSystemMasterBaseURL = url
}

func (s *SystemOptionsBuilder) AppMasterContainerResourceRequirements(resourceRequirements v1.ResourceRequirements) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/3scale/amp/component/zync.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ func (zync *Zync) DeploymentConfig() *appsv1.DeploymentConfig {
ValueFrom: &v1.EnvVarSource{
SecretKeyRef: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "zync",
Name: ZyncSecretName,
},
Key: "DATABASE_URL",
Key: ZyncSecretDatabaseURLFieldName,
},
},
},
Expand Down
15 changes: 10 additions & 5 deletions pkg/3scale/amp/template/adapters/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ func (s *System) options() (*component.SystemOptions, error) {
sob.AdminAccessToken("${ADMIN_ACCESS_TOKEN}")
sob.AdminPassword("${ADMIN_PASSWORD}")
sob.AdminUsername("${ADMIN_USERNAME}")
sob.AdminEmail("${ADMIN_EMAIL}")
adminEmail := "${ADMIN_EMAIL}"
sob.AdminEmail(&adminEmail)
sob.AmpRelease("${AMP_RELEASE}")
sob.ApicastAccessToken("${APICAST_ACCESS_TOKEN}")
sob.ApicastRegistryURL("${APICAST_REGISTRY_URL}")
Expand All @@ -148,10 +149,14 @@ func (s *System) options() (*component.SystemOptions, error) {
sob.AppLabel("${APP_LABEL}")
sob.RecaptchaPublicKey("${RECAPTCHA_PUBLIC_KEY}")
sob.RecaptchaPrivateKey("${RECAPTCHA_PRIVATE_KEY}")
sob.RedisURL("${SYSTEM_REDIS_URL}")
sob.RedisNamespace("${SYSTEM_REDIS_NAMESPACE}")
sob.MessageBusRedisURL("${SYSTEM_MESSAGE_BUS_REDIS_URL}")
sob.MessageBusRedisNamespace("${SYSTEM_MESSAGE_BUS_REDIS_NAMESPACE}")
redisUrl := "${SYSTEM_REDIS_URL}"
sob.RedisURL(&redisUrl)
redisNamespace := "${SYSTEM_REDIS_NAMESPACE}"
sob.RedisNamespace(&redisNamespace)
messageBusRedisURL := "${SYSTEM_MESSAGE_BUS_REDIS_URL}"
sob.MessageBusRedisURL(&messageBusRedisURL)
messageBusRedisNamespace := "${SYSTEM_MESSAGE_BUS_REDIS_NAMESPACE}"
sob.MessageBusRedisNamespace(&messageBusRedisNamespace)
sob.AppSecretKeyBase("${SYSTEM_APP_SECRET_KEY_BASE}")
sob.BackendSharedSecret("${SYSTEM_BACKEND_SHARED_SECRET}")
sob.TenantName("${TENANT_NAME}")
Expand Down

0 comments on commit f9804f8

Please sign in to comment.