mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Sync async_nats work with master
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
@ -64,6 +64,21 @@ func (ReadConfig) Read(hasEnv HasEnv) GatewayConfig {
|
||||
}
|
||||
}
|
||||
|
||||
faasNATSAddress := hasEnv.Getenv("faas_nats_address")
|
||||
if len(faasNATSAddress) > 0 {
|
||||
cfg.NATSAddress = &faasNATSAddress
|
||||
}
|
||||
|
||||
faasNATSPort := hasEnv.Getenv("faas_nats_port")
|
||||
if len(faasNATSPort) > 0 {
|
||||
port, err := strconv.Atoi(faasNATSPort)
|
||||
if err == nil {
|
||||
cfg.NATSPort = &port
|
||||
} else {
|
||||
log.Println("faas_nats_port invalid number: " + faasNATSPort)
|
||||
}
|
||||
}
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
@ -72,6 +87,14 @@ type GatewayConfig struct {
|
||||
ReadTimeout time.Duration
|
||||
WriteTimeout time.Duration
|
||||
FunctionsProviderURL *url.URL
|
||||
NATSAddress *string
|
||||
NATSPort *int
|
||||
}
|
||||
|
||||
// UseNATS Use NATSor not
|
||||
func (g *GatewayConfig) UseNATS() bool {
|
||||
return g.NATSPort != nil &&
|
||||
g.NATSAddress != nil
|
||||
}
|
||||
|
||||
// UseExternalProvider decide whether to bypass built-in Docker Swarm engine
|
||||
|
Reference in New Issue
Block a user