From 5efd3c5b44eb19859d800692f2278b83d0bc89ec Mon Sep 17 00:00:00 2001 From: "John Barton (joho)" Date: Fri, 2 Aug 2013 14:33:40 +1000 Subject: [PATCH] Do more of the documenting. --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7a9d0c3..fbf5dfe 100644 --- a/README.md +++ b/README.md @@ -44,14 +44,34 @@ func main() { } ``` -While `.env` in the project root is the default, you don't have to be constrained +If you're even lazier than that, you can just take advantage of the autoload package which will read in `.env` on import + +```go +import _ "github.com/joho/godotenv/autoload" +``` + +While `.env` in the project root is the default, you don't have to be constrained, both examples below are 100% legit ```go _ = godotenv.Load("somerandomfile") _ = godotenv.Load("filenumberone.env", "filenumbertwo.env") ``` -Are all valid options +If you want to be really fancy with your env file you can do comments and exports (below is a valid env file) + +```shell +# I am a comment and that is OK +SOME_VAR=someval +FOO=BAR # comments at line end are OK too +export BAR=BAZ +``` + +Or finally you can do YAML(ish) style + +```yaml +FOO: bar +BAR: baz +``` ## Contributing