de.gesellix.docker.client.EnvFileParser.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docker-client Show documentation
Show all versions of docker-client Show documentation
A Docker client for the JVM written in Groovy
package de.gesellix.docker.client
class EnvFileParser {
List parse(File file) {
List env = new ArrayList<>()
file.eachLine { String line ->
if (line.trim() && !line.matches("\\s*#.*")) {
if (line.contains('=')) {
env << line.replaceAll("^\\s*", "")
}
else {
env << ("${line.trim()}=${System.getenv(line.trim())}" as String)
}
}
return null
}
return env
}
}