init
This commit is contained in:
commit
c5ee4e27e6
131 files changed
+9926
No files matched your search
@@ -0,0 +1,23 @@
|
||||
allprojects {
|
||||
beforeEvaluate {
|
||||
loadEnvFile("${rootDir.absolutePath}/.env")
|
||||
}
|
||||
}
|
||||
|
||||
fun loadEnvFile(fileName: String) {
|
||||
val file = rootProject.file(fileName)
|
||||
if (file.exists()) {
|
||||
file.forEachLine { line ->
|
||||
if (line.isNotBlank() && !line.startsWith("#")) {
|
||||
val parts = line.split("=", limit = 2)
|
||||
if (parts.size == 2) {
|
||||
System.setProperty(parts[0].trim(), parts[1].trim())
|
||||
} else {
|
||||
throw IllegalArgumentException("Invalid line in env file: $line")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw IllegalArgumentException("Env file '$fileName' does not exist.")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user