problem: need to setup upstream auth w/o storing passwords in config

solution: use environment variable placeholders
This commit is contained in:
Igor Artamonov
2019-08-07 22:50:07 -04:00
parent 29691c4025
commit 24c325f83a
2 changed files with 33 additions and 1 deletions

View File

@@ -95,4 +95,26 @@ class UpstreamsConfigReaderSpec extends Specification {
labels["api"] == "geth"
}
}
def "Post process for usual strings"() {
expect:
s == reader.postProcess(s)
where:
s << ["", "a", "13143", "/etc/client1.myservice.com.key", "true", "1a68f20154fc258fe4149c199ad8f281"]
}
def "Post process replaces from env"() {
setup:
System.setProperty("id", "1")
System.setProperty("HOME", "/home/user")
System.setProperty("PASSWORD", "1a68f20154fc258fe4149c199ad8f281")
expect:
replaced == reader.postProcess(orig)
where:
orig | replaced
"p_\${id}" | "p_1"
"home: \${HOME}" | "home: /home/user"
"\${PASSWORD}" | "1a68f20154fc258fe4149c199ad8f281"
}
}