All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.gesellix.docker.client.EnvFileParser.groovy Maven / Gradle / Ivy

There is a newer version: 2024-09-15T19-40-00-groovy-4
Show newest version
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
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy