mirror of https://github.com/joho/godotenv.git
Use SplitN instead of split
parent
6e333bd708
commit
7e3e1e2c6c
|
@ -0,0 +1,2 @@
|
|||
export OPTION_A='postgres://localhost:5432/database?sslmode=disable'
|
||||
|
|
@ -138,7 +138,7 @@ func parseLine(line string) (key string, value string, err error) {
|
|||
}
|
||||
|
||||
// now split key from value
|
||||
splitString := strings.Split(line, "=")
|
||||
splitString := strings.SplitN(line, "=", 2)
|
||||
|
||||
if len(splitString) != 2 {
|
||||
// try yaml mode!
|
||||
|
|
|
@ -93,6 +93,15 @@ func TestLoadExportedEnv(t *testing.T) {
|
|||
loadEnvAndCompareValues(t, envFileName, expectedValues)
|
||||
}
|
||||
|
||||
func TestLoadEqualsEnv(t *testing.T) {
|
||||
envFileName := "fixtures/equals.env"
|
||||
expectedValues := map[string]string{
|
||||
"OPTION_A": "postgres://localhost:5432/database?sslmode=disable",
|
||||
}
|
||||
|
||||
loadEnvAndCompareValues(t, envFileName, expectedValues)
|
||||
}
|
||||
|
||||
func TestLoadQuotedEnv(t *testing.T) {
|
||||
envFileName := "fixtures/quoted.env"
|
||||
expectedValues := map[string]string{
|
||||
|
|
Loading…
Reference in New Issue