save env in project.env with gradle so it can be reused
This commit is contained in:
parent
22236cf33d
commit
32d929e234
|
@ -1,18 +1,21 @@
|
|||
def readDotEnv = {
|
||||
def env = [:]
|
||||
def envFile = System.env['ENVFILE'] ?: "$project.rootDir/../.env"
|
||||
println("Reading env from: $envFile")
|
||||
new File(envFile).eachLine { line ->
|
||||
def (key, val) = line.tokenize('=')
|
||||
if (key && val) {
|
||||
env.put(key, val)
|
||||
}
|
||||
}
|
||||
env
|
||||
project.ext.set("env", env)
|
||||
}
|
||||
|
||||
readDotEnv()
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
readDotEnv().each { k, v ->
|
||||
project.env.each { k, v ->
|
||||
buildConfigField "String", k, "\"$v\""
|
||||
resValue "string", k, "\"$v\""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue