Use authentication token from config for communication with Nomad

This commit is contained in:
Jan-Eric Hellenberg
2021-07-26 11:41:30 +02:00
committed by Jan-Eric Hellenberg
parent 23b726cef9
commit 3aa1227db6
7 changed files with 58 additions and 46 deletions

View File

@@ -45,7 +45,11 @@ func runServer(server *http.Server) {
func initServer() *http.Server {
// API initialization
nomadAPIClient, err := nomad.NewExecutorAPI(config.Config.NomadAPIURL(), config.Config.Nomad.Namespace)
nomadAPIClient, err := nomad.NewExecutorAPI(
config.Config.NomadAPIURL(),
config.Config.Nomad.Namespace,
config.Config.Nomad.Token,
)
if err != nil {
log.WithError(err).WithField("nomad url", config.Config.NomadAPIURL()).Fatal("Error parsing the nomad url")
}