Skip to content

Commit

Permalink
Merge pull request #104 from kristinaspring/feature/add-soa-provider-…
Browse files Browse the repository at this point in the history
…to-config

Passing SOA Provider to webhookfactory
  • Loading branch information
johnabass authored Oct 10, 2018
2 parents cf8cf73 + 0237eb5 commit c00ebe5
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 22 deletions.
2 changes: 2 additions & 0 deletions example-caduceus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ log:
env: test
fqdn: 127.0.0.1
scheme: http
soa:
provider: "localhost:5079"

numWorkerThreads: 10
jobQueueSize: 10
Expand Down
19 changes: 17 additions & 2 deletions src/caduceus/caduceus.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/Comcast/webpa-common/webhook"
"github.com/Comcast/webpa-common/webhook/aws"
"github.com/SermoDigital/jose/jwt"
"github.com/go-kit/kit/log/level"
"github.com/gorilla/mux"
"github.com/justinas/alice"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -203,9 +204,9 @@ func caduceus(arguments []string) int {
Host: v.GetString("fqdn") + v.GetString("primary.address"),
}

webhookFactory.Initialize(router, selfURL, webhookHandler, logger, metricsRegistry, nil)
webhookFactory.Initialize(router, selfURL, v.GetString("soa.provider"), webhookHandler, logger, metricsRegistry, nil)

_, runnable := webPA.Prepare(logger, nil, metricsRegistry, router)
_, runnable, done := webPA.Prepare(logger, nil, metricsRegistry, router)

waitGroup, shutdown, err := concurrent.Execute(runnable)
if err != nil {
Expand Down Expand Up @@ -246,6 +247,20 @@ func caduceus(arguments []string) int {

signals := make(chan os.Signal, 10)
signal.Notify(signals)
for exit := false; !exit; {
select {
case s := <-signals:
if s != os.Kill && s != os.Interrupt {
logger.Log(level.Key(), level.InfoValue(), logging.MessageKey(), "ignoring signal", "signal", s)
} else {
logger.Log(level.Key(), level.ErrorValue(), logging.MessageKey(), "exiting due to signal", "signal", s)
exit = true
}
case <-done:
logger.Log(level.Key(), level.ErrorValue(), logging.MessageKey(), "one or more servers exited")
exit = true
}
}
s := server.SignalWait(infoLog, signals, os.Interrupt, os.Kill)
errorLog.Log(logging.MessageKey(), "exiting due to signal", "signal", s)
close(shutdown)
Expand Down
47 changes: 28 additions & 19 deletions src/glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/glide.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package: .
import:
- package: github.com/Comcast/webpa-common
version: fe5c1484b2da90c16669df9a4e92d0517c29fff5
version: 06a48c25796c0c72ba091ebd8b9e7eeca94c1d96
- package: github.com/satori/go.uuid
version: f58768cc1a7a7e77a3bd49e98cdd21419399b6a3
- package: github.com/gorilla/websocket

0 comments on commit c00ebe5

Please sign in to comment.