mirror of https://github.com/joho/godotenv.git
Red, green, rinse repeat.
parent
98b43188a1
commit
aa6e870b57
|
@ -83,7 +83,7 @@ func parseLine(line string) (key string, value string, err error) {
|
|||
segmentsBetweenHashes := strings.Split(value, "#")
|
||||
value = segmentsBetweenHashes[0]
|
||||
// open quote in leftmost segment
|
||||
if strings.Count(value, "\"") == 1 {
|
||||
if strings.Count(value, "\"") == 1 || strings.Count(value, "'") == 1 {
|
||||
value = value + "#" + segmentsBetweenHashes[1]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ func TestParsing(t *testing.T) {
|
|||
// it 'allows # in quoted value' do
|
||||
// expect(env('foo="bar#baz" # comment')).to eql('foo' => 'bar#baz')
|
||||
parseAndCompare(t, "FOO=\"bar#baz\" # comment", "FOO", "bar#baz")
|
||||
parseAndCompare(t, "FOO='bar#baz' # comment", "FOO", "bar#baz")
|
||||
|
||||
// it 'ignores comment lines' do
|
||||
// expect(env("\n\n\n # HERE GOES FOO \nfoo=bar")).to eql('foo' => 'bar')
|
||||
|
|
Loading…
Reference in New Issue