Allow for customizing the name of the target NATS Streaming cluster.

Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
This commit is contained in:
Bruno Miguel Custódio
2019-11-25 10:40:37 +00:00
committed by Alex Ellis
parent ff5ec39e4d
commit 365f459b3f
7 changed files with 49 additions and 10 deletions

View File

@ -98,6 +98,14 @@ func (ReadConfig) Read(hasEnv HasEnv) (*GatewayConfig, error) {
}
}
faasNATSClusterName := hasEnv.Getenv("faas_nats_cluster_name")
if len(faasNATSClusterName) > 0 {
cfg.NATSClusterName = &faasNATSClusterName
} else {
v := "faas-cluster"
cfg.NATSClusterName = &v
}
prometheusPort := hasEnv.Getenv("faas_prometheus_port")
if len(prometheusPort) > 0 {
prometheusPortVal, err := strconv.Atoi(prometheusPort)
@ -186,6 +194,9 @@ type GatewayConfig struct {
// Port of the NATS Service. Required for async mode.
NATSPort *int
// The name of the NATS Streaming cluster. Required for async mode.
NATSClusterName *string
// Host to connect to Prometheus.
PrometheusHost string