diff --git a/envparse.go b/envparse.go index 9467dfd..29d43f5 100644 --- a/envparse.go +++ b/envparse.go @@ -135,11 +135,12 @@ func parseLine(ln []byte) ([]byte, []byte, error) { for _, v := range key[1:] { switch { case v == '_': + case v == '.': case v >= 'A' && v <= 'Z': case v >= 'a' && v <= 'z': case v >= '0' && v <= '9': default: - return nil, nil, fmt.Errorf("key characters must be [A-Za-z0-9_] but found %q", v) + return nil, nil, fmt.Errorf("key characters must be [A-Za-z0-9_.] but found %q", v) } } diff --git a/envparse_test.go b/envparse_test.go index 086e406..027c38e 100644 --- a/envparse_test.go +++ b/envparse_test.go @@ -105,6 +105,7 @@ func TestParseLine_OK(t *testing.T) { {"EscapedUnicodeCombined", `U4="\u2318\uD83D\uDE01"`, "U4", "\U00002318\U0001F601"}, {"README.mdEscapedUnicode", `FOO="The template value\nmay have included\nsome newlines!\n\ud83d\udd25"`, "FOO", "The template value\nmay have included\nsome newlines!\n🔥"}, {"UnderscoreKey", "_=x' ' ", "_", "x "}, + {"DottedKey", "FOO.BAR=x", "FOO.BAR", "x"}, {"README.md", `SOME_KEY = normal unquoted \text 'plus single quoted\' "\"double quoted " # EOL`, "SOME_KEY", `normal unquoted \text plus single quoted\ "double quoted `}, {"WindowsNewline", `w="\r\n"`, "w", "\r\n"}, }