Skip to content

Commit

Permalink
Merge pull request #16 from wttech/config-precedence
Browse files Browse the repository at this point in the history
Config precedence
  • Loading branch information
krystian-panek-vmltech authored Jul 29, 2022
2 parents 53c0bd4 + 113c605 commit 5209ef2
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ class PropertyParser(anyProject: Project) {

private val project = anyProject.rootProject

/**
* @see <https://stackoverflow.com/a/11077282>
*/
private fun find(name: String): String? {
if (project.hasProperty(name)) {
return project.property(name).toString()
val envValue: String? = System.getenv(name.toUpperSnakeCase())
if (envValue != null) {
return envValue
}

val systemValue: String? = System.getProperty(name)
if (systemValue != null) {
return systemValue
}

val envValue: String? = System.getenv(name.toUpperSnakeCase())
if (envValue != null) {
return envValue
if (project.hasProperty(name)) {
return project.property(name).toString()
}

return null
Expand Down

0 comments on commit 5209ef2

Please sign in to comment.