diff --git a/README.md b/README.md index 7f87401..ac7bb50 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ $ wget https://github.com/Droplr/aws-env/raw/master/bin/aws-env-linux-amd64 -O a * `AWS_ENV_PATH` - path of parameters. If it won't be provided, aws-env will exit immediately. That way, you can run your Dockerfiles locally. * `AWS_REGION` and AWS Credentials - [configuring credentials](https://github.com/aws/aws-sdk-go#configuring-credentials) ``` -$ `AWS_ENV_PATH=/prod/my-app/ AWS_REGION=us-west-2 ./aws-env` && npm run +$ eval $(AWS_ENV_PATH=/prod/my-app/ AWS_REGION=us-west-2 ./aws-env) && node -e "console.log(process.env)" ``` @@ -45,7 +45,7 @@ RUN apk update && apk upgrade && \ RUN wget https://github.com/Droplr/aws-env/raw/master/bin/aws-env-linux-amd64 -O /bin/aws-env && \ chmod +x /bin/aws-env -CMD `aws-env` && node -e "console.log(process.env)" +CMD eval $(aws-env) && node -e "console.log(process.env)" ``` ``` diff --git a/aws-env.go b/aws-env.go index c3677d2..8f46356 100644 --- a/aws-env.go +++ b/aws-env.go @@ -56,6 +56,7 @@ func PrintExportParameter(path string, parameter *ssm.Parameter) { value := *parameter.Value env := strings.Trim(name[len(path):], "/") + value = strings.Replace(value, "\n", "\\n", -1) - fmt.Printf("export %s=%s \n", env, value) + fmt.Printf("export %s=$'%s'\n", env, value) } diff --git a/bin/aws-env-darwin-386 b/bin/aws-env-darwin-386 index 7cebdcf..855ca69 100755 Binary files a/bin/aws-env-darwin-386 and b/bin/aws-env-darwin-386 differ diff --git a/bin/aws-env-darwin-amd64 b/bin/aws-env-darwin-amd64 index 5d952de..0b7a795 100755 Binary files a/bin/aws-env-darwin-amd64 and b/bin/aws-env-darwin-amd64 differ diff --git a/bin/aws-env-linux-386 b/bin/aws-env-linux-386 index 4223228..1b17514 100755 Binary files a/bin/aws-env-linux-386 and b/bin/aws-env-linux-386 differ diff --git a/bin/aws-env-linux-amd64 b/bin/aws-env-linux-amd64 index ae61417..bbcc1f1 100755 Binary files a/bin/aws-env-linux-amd64 and b/bin/aws-env-linux-amd64 differ diff --git a/bin/aws-env-windows-386 b/bin/aws-env-windows-386 index ed967e6..22111b6 100755 Binary files a/bin/aws-env-windows-386 and b/bin/aws-env-windows-386 differ diff --git a/bin/aws-env-windows-amd64 b/bin/aws-env-windows-amd64 index 48adee4..64b1a18 100755 Binary files a/bin/aws-env-windows-amd64 and b/bin/aws-env-windows-amd64 differ