problem: need to setup upstream auth w/o storing passwords in config
solution: use environment variable placeholders
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user