aboutsummaryrefslogtreecommitdiffstats
path: root/standalone-container
diff options
context:
space:
mode:
authorHarald Musum <musum@oath.com>2018-04-20 09:43:34 +0200
committerHarald Musum <musum@oath.com>2018-04-20 09:43:34 +0200
commit9267dc0540f1657ddc2ba34e856432943757a68d (patch)
tree2da85c13f981671f1153aa47c77a676ab427194b /standalone-container
parentf3be93c03488b6ecdf09a9aa0940a8ec0a35409f (diff)
Fix getting value of VESPA_CONFIGSERVERS
This is a regular environment variable, so should not look for it with any package prefix
Diffstat (limited to 'standalone-container')
-rw-r--r--standalone-container/src/main/scala/com/yahoo/container/standalone/CloudConfigInstallVariables.scala12
1 files changed, 11 insertions, 1 deletions
diff --git a/standalone-container/src/main/scala/com/yahoo/container/standalone/CloudConfigInstallVariables.scala b/standalone-container/src/main/scala/com/yahoo/container/standalone/CloudConfigInstallVariables.scala
index c68ec29fb83..9a6456cb8fc 100644
--- a/standalone-container/src/main/scala/com/yahoo/container/standalone/CloudConfigInstallVariables.scala
+++ b/standalone-container/src/main/scala/com/yahoo/container/standalone/CloudConfigInstallVariables.scala
@@ -39,7 +39,7 @@ class CloudConfigInstallVariables extends CloudConfigOptions {
override val loadBalancerAddress = optionalInstallVar[java.lang.String]("load_balancer_address")
private def getConfigservers = {
- val newVar = installVar("VESPA_CONFIGSERVERS", "services") withDefault Array[ConfigServer]()
+ val newVar = envVar("VESPA_CONFIGSERVERS") withDefault Array[ConfigServer]()
val oldVar = installVar("addr_configserver", "services") withDefault Array[ConfigServer]()
if (newVar.nonEmpty) newVar else oldVar
}
@@ -56,6 +56,16 @@ object CloudConfigInstallVariables {
private def installVar(setting:String, installPkg: String = "cloudconfig_server") = new InstallVariable(installPkg, setting)
+ private class EnvVariable(name: String) {
+ val value = Environment.env(name)
+
+ def withDefault[T](defaultValue: T)(implicit c: Converter[T]) : T = {
+ value map { implicitly[Converter[T]].convert } getOrElse defaultValue
+ }
+ }
+
+ private def envVar(name:String) = new EnvVariable(name)
+
private def optionalInstallVar[T](setting:String, installPkg: String = "cloudconfig_server")(implicit c: Converter[T]): Optional[T] = {
Environment.optionalInstallVariable(installPkg + "." + setting) map ( c.convert )
}