From a01a834e1654b4c9ca5b3ad05159445cc9c7ad08 Mon Sep 17 00:00:00 2001 From: "John Barton (joho)" Date: Sun, 12 Oct 2014 10:38:08 +1100 Subject: [PATCH] Update docs for the bin command. --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cc3843b..05c47e6 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,23 @@ From the original Library: > > But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. Dotenv load variables from a .env file into ENV when the environment is bootstrapped. +It can be used as a library (for loading in env for your own daemons etc) or as a bin command. + +There is test coverage and CI for both linuxish and windows environments, but I make no guarantees about the bin version working on windows. + ## Installation +As a library + ```shell go get github.com/joho/godotenv ``` +or if you want to use it as a bin command +```shell +go get github.com/joho/godotenv/cmd/godotenv +``` + ## Usage Add your application configuration to your `.env` file in the root of your project: @@ -85,7 +96,15 @@ myEnv, err := godotenv.Read() s3Bucket := myEnv["S3_BUCKET"] ``` -end +### Command Mode + +Assuming you've installed the command as above and you've got `$GOPATH/bin` in your `$PATH` + +``` +godotenv -f /some/path/to/.env some_command with some args +``` + +If you don't specify `-f` it will fall back on the default of loading `.env` in `PWD` ## Contributing