forked from coop-cloud-mirrors/godotenv
export keyword parsing
This commit is contained in:
parent
4a2748eb3c
commit
37c8b8e487
@ -70,7 +70,11 @@ func parseLine(line string) (key string, value string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
key = strings.Trim(splitString[0], " ")
|
||||
key = splitString[0]
|
||||
if strings.HasPrefix(key, "export") {
|
||||
key = strings.TrimPrefix(key, "export")
|
||||
}
|
||||
key = strings.Trim(key, " ")
|
||||
|
||||
value = strings.Trim(splitString[1], " \"'")
|
||||
value = strings.Replace(value, "\\\"", "\"", -1)
|
||||
|
@ -67,4 +67,7 @@ func TestParsing(t *testing.T) {
|
||||
// parses yaml style options
|
||||
parseAndCompare(t, "OPTION_A: 1", "OPTION_A", "1")
|
||||
|
||||
// parses export keyword
|
||||
parseAndCompare(t, "export OPTION_A=2", "OPTION_A", "2")
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user