Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dedicated dotenv library? #5

Closed
joho opened this issue Aug 30, 2013 · 7 comments
Closed

Use dedicated dotenv library? #5

joho opened this issue Aug 30, 2013 · 7 comments

Comments

@joho
Copy link

joho commented Aug 30, 2013

Hi @ddollar,

I've got a go dotenv port at https://github.com/joho/godotenv which might be worth integrating to make forego and foreman closer to 100% compatible. I'd ported all the tests from the ruby dotenv library to ensure compatibility.

I'm happy to do a pull request if you want to use the library, just thought it'd be polite to ask first incase you wanted to do the .env handling yourself.

@subosito
Copy link

👍 @joho. Would be great to see opensource projects collaborate to reduce duplication while increasing ability.

Just in case you don't know, I did also create similar project like yours, a port of dotenv, https://github.com/subosito/gotenv, which is also fully compatible with dotenv.

Would be great to see one of these ports to be merged into forego, let see @ddolllar response :).

By the way, what do you think is better, is it ok to keep two similar projects exists along with others or merge into a single project?

@ddollar
Copy link
Owner

ddollar commented Sep 4, 2013

Do either of these libraries let me load a .env file into a map rather than straight into os.Environ?

@joho
Copy link
Author

joho commented Sep 4, 2013

Not at this stage, but I could add a godotenv.Read() that returns instead of doing os.Setenv on everything

On Wednesday, 4 September 2013 at 11:49 AM, David Dollar wrote:

Do either of these libraries let me load a .env file into a map rather than straight into os.Environ?


Reply to this email directly or view it on GitHub (#5 (comment)).

@ddollar
Copy link
Owner

ddollar commented Sep 4, 2013

I think that would be necessary to add it cleanly to forego. If you want to either create that Read method or even better submit a pull request to forego that would be awesome.

@subosito
Copy link

subosito commented Sep 4, 2013

Gotenv have support for that. You can using Parse() function. Here's the example:

// import "strings"

pairs := gotenv.Parse(strings.NewReader("FOO=test\nBAR=$FOO"))
// gotenv.Env{"FOO": "test", "BAR": "test"}

pairs = gotenv.Parse(strings.NewReader(`FOO="bar"`))
// gotenv.Env{"FOO": "bar"}

@ddollar
Copy link
Owner

ddollar commented Sep 4, 2013

@subosito Perfect, I switched forego to use gotenv. Thanks!

@ddollar ddollar closed this as completed Sep 4, 2013
@subosito
Copy link

subosito commented Sep 4, 2013

You're welcome @ddollar 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants