Support customising the NATS Streaming channel.

Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
This commit is contained in:
Bruno Miguel Custódio
2019-12-10 11:06:47 +00:00
committed by Alex Ellis
parent 3422bdcce9
commit 03dc8824d2
7 changed files with 39 additions and 7 deletions

View File

@ -106,6 +106,14 @@ func (ReadConfig) Read(hasEnv HasEnv) (*GatewayConfig, error) {
cfg.NATSClusterName = &v
}
faasNATSChannel := hasEnv.Getenv("faas_nats_channel")
if len(faasNATSChannel) > 0 {
cfg.NATSChannel = &faasNATSChannel
} else {
v := "faas-request"
cfg.NATSChannel = &v
}
prometheusPort := hasEnv.Getenv("faas_prometheus_port")
if len(prometheusPort) > 0 {
prometheusPortVal, err := strconv.Atoi(prometheusPort)
@ -197,6 +205,9 @@ type GatewayConfig struct {
// The name of the NATS Streaming cluster. Required for async mode.
NATSClusterName *string
// NATSChannel is the name of the NATS Streaming channel used for asynchronous function invocations.
NATSChannel *string
// Host to connect to Prometheus.
PrometheusHost string