I am new to Gradle.
Currently I have this task:
task fooTask {
doLast {
exec {
environment 'FOO_KEY', '1234567' // Load from file here!
commandLine 'fooScript.sh'
}
}
}
fooScript.sh
#!/bin/bash
echo $FOO_KEY
Everything works great. But I have env.file
with all needed environment variables. This file is used in Docker builder.
env.file
FOO_KEY=1234567
Question: how can I use env.file
together with Gradle environment
to load all needed env. params?
What about this :
task fooTask {
doLast {
exec {
file('env.file').readLines().each() {
def (key, value) = it.tokenize('=')
environment key, value
}
commandLine 'fooScript.sh'
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With