Skip to content

Commit

Permalink
configurable env token name
Browse files Browse the repository at this point in the history
  • Loading branch information
sohaibiftikhar committed Nov 20, 2018
1 parent 21f60ff commit e7d4410
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions server/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ broccoli {
nomad {
# The URL of the Nomad client to be used by Broccoli.
url = "http://localhost:4646"
token-env-name = "NOMAD_BROCCOLI_TOKEN"
}

# The frequency by which to ask Nomad and Consul for running tasks and services respectively
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package de.frosner.broccoli.nomad

import com.typesafe.config.Config

/**
* The Nomad configuration.
*
* @param url The URL to connect to to access nomad via HTTP.
*/
final case class NomadConfiguration(url: String)
final case class NomadConfiguration(url: String, tokenEnvName: String)
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class NomadService @Inject()(nomadConfiguration: NomadConfiguration, ws: WSClien

private val log = play.api.Logger(getClass)

val headers = sys.env.get("NOMAD-BROCCOLI-TOKEN").map(authToken => ("X-Nomad-Token", authToken)).toList
val headers = sys.env.get(nomadConfiguration.tokenEnvName).map(authToken => ("X-Nomad-Token", authToken)).toList

log.info(s"Starting $this")

Expand Down

0 comments on commit e7d4410

Please sign in to comment.