Skip to content

Commit

Permalink
Allow single quotes around value (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
joscdk authored and gperdomor committed Feb 6, 2019
1 parent 0d29441 commit 54e9b97
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/ServiceExt/Environment+DotEnv.swift
Expand Up @@ -52,6 +52,14 @@ public extension Environment {
value.remove(at: value.index(before: value.endIndex))
value = value.replacingOccurrences(of: "\\\"", with: "\"")
}

// remove surrounding single quotes from value & convert remove escape character before any embedded quotes
if value[value.startIndex] == "'" && value[value.index(before: value.endIndex)] == "'" {
value.remove(at: value.startIndex)
value.remove(at: value.index(before: value.endIndex))
value = value.replacingOccurrences(of: "'", with: "'")
}

setenv(key, value, 1)
}
}
Expand Down

0 comments on commit 54e9b97

Please sign in to comment.