diff --git a/api/v1beta1/types.go b/api/v1beta1/types.go index 1b1a8ef..8a864b3 100644 --- a/api/v1beta1/types.go +++ b/api/v1beta1/types.go @@ -36,6 +36,8 @@ type Server struct { IdleTimeout int `json:"idleTimeout,omitempty" yaml:"idleTimeout,omitempty"` // LogLevel log level, info, debug, trace, off LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` + // Redis contains redis database details + Redis Redis `json:"redis,omitempty" yaml:"redis,omitempty"` // Cors holds proxy global cors Cors Cors `json:"cors,omitempty" yaml:"cors,omitempty,omitempty"` // InterceptErrors holds the status codes to intercept the error from backend @@ -85,3 +87,8 @@ type RouteHealthCheck struct { Timeout string `json:"timeout,omitempty" yaml:"timeout"` HealthyStatuses []int `json:"healthyStatuses,omitempty" yaml:"healthyStatuses"` } +type Redis struct { + // Addr redis hostname and port number : + Addr string `json:"addr,omitempty" yaml:"addr,omitempty"` + Password string `json:"password,omitempty" yaml:"password,omitempty"` +} diff --git a/internal/controller/types.go b/internal/controller/types.go index e6a5f9a..029df44 100644 --- a/internal/controller/types.go +++ b/internal/controller/types.go @@ -9,7 +9,7 @@ type Gateway struct { // SSLKeyFile SSL Private key file SSLKeyFile string `yaml:"sslKeyFile"` // Redis contains redis database details - Redis Redis `yaml:"redis"` + Redis gomaprojv1beta1.Redis `yaml:"redis"` // WriteTimeout defines proxy write timeout WriteTimeout int `yaml:"writeTimeout"` // ReadTimeout defines proxy read timeout diff --git a/internal/controller/util.go b/internal/controller/util.go index c5fb717..a50cbd0 100644 --- a/internal/controller/util.go +++ b/internal/controller/util.go @@ -6,7 +6,7 @@ func mapToGateway(g gomaprojv1beta1.GatewaySpec) Gateway { return Gateway{ SSLKeyFile: "", SSLCertFile: "", - Redis: Redis{}, + Redis: g.Server.Redis, WriteTimeout: g.Server.WriteTimeout, ReadTimeout: g.Server.ReadTimeout, IdleTimeout: g.Server.IdleTimeout,