mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Update nats-queue-worker package to 0.4.7
This package version supports running OpenFaas on hosts the contain `.` in their hostname i.e. computer-a.acme.com Signed-off-by: Edward Wilde <ewilde@gmail.com>
This commit is contained in:
9
gateway/vendor/github.com/openfaas/nats-queue-worker/handler/handler.go
generated
vendored
9
gateway/vendor/github.com/openfaas/nats-queue-worker/handler/handler.go
generated
vendored
@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/nats-io/go-nats-streaming"
|
||||
"github.com/openfaas/faas/gateway/queue"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// NatsQueue queue for work
|
||||
@ -22,9 +23,11 @@ type NatsConfig interface {
|
||||
type DefaultNatsConfig struct {
|
||||
}
|
||||
|
||||
var supportedCharacters, _ = regexp.Compile("[^a-zA-Z0-9-_]+")
|
||||
|
||||
func (DefaultNatsConfig) GetClientID() string {
|
||||
val, _ := os.Hostname()
|
||||
return "faas-publisher-" + val
|
||||
return getClientId(val)
|
||||
}
|
||||
|
||||
// CreateNatsQueue ready for asynchronous processing
|
||||
@ -58,3 +61,7 @@ func (q *NatsQueue) Queue(req *queue.Request) error {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func getClientId(hostname string) string {
|
||||
return "faas-publisher-" + supportedCharacters.ReplaceAllString(hostname, "_")
|
||||
}
|
Reference in New Issue
Block a user