2016-02-23 00:18:50 +00:00
|
|
|
def readDotEnv = {
|
|
|
|
def env = [:]
|
2016-02-24 00:07:24 +00:00
|
|
|
def envFile = System.env['ENVFILE'] ?: "$project.rootDir/../.env"
|
2016-02-23 00:18:50 +00:00
|
|
|
new File(envFile).eachLine { line ->
|
|
|
|
def (key, val) = line.tokenize('=')
|
|
|
|
if (key && val) {
|
|
|
|
env.put(key, val)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
env
|
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
|
|
|
defaultConfig {
|
|
|
|
readDotEnv().each { k, v ->
|
|
|
|
buildConfigField "String", k, "\"$v\""
|
|
|
|
resValue "string", k, "\"$v\""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|