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

Add docs for hexdocs #39

Open
fireproofsocks opened this issue Mar 31, 2021 · 3 comments
Open

Add docs for hexdocs #39

fireproofsocks opened this issue Mar 31, 2021 · 3 comments

Comments

@fireproofsocks
Copy link

It would be useful to groom through the module and function docs so hexdocs can be as useful a reference (if not more) than the Github README.

@iloveitaly
Copy link
Collaborator

@fireproofsocks that would be great! Want to submit a PR?

@fireproofsocks
Copy link
Author

I started combing through things and adding ## Examples blocks -- see PR #40 (comments welcome).

However, I have a couple questions:

I'm confused by the Dotenv.load!/1 vs Dotenv.load/1 -- usually I would expect a function ending with ! to raise on error, and the other to wrap its result in a tuple, but both variants do not handle errors, e.g.

iex(5)> Dotenv.load("asdfas")
** (File.Error) could not read file "asdfas": no such file or directory
    (elixir 1.11.1) lib/file.ex:354: File.read!/1
    (dotenv 3.1.0) lib/dotenv.ex:241: Dotenv.read_env_file/1
    (dotenv 3.1.0) lib/dotenv.ex:158: Dotenv.load/1
iex(5)> Dotenv.load!("asdfas")
** (File.Error) could not read file "asdfas": no such file or directory
    (elixir 1.11.1) lib/file.ex:354: File.read!/1
    (dotenv 3.1.0) lib/dotenv.ex:241: Dotenv.read_env_file/1
    (dotenv 3.1.0) lib/dotenv.ex:158: Dotenv.load/1
    (dotenv 3.1.0) lib/dotenv.ex:135: Dotenv.load!/1

The Dotenv.Env.get/3 function seems to have arguments swapped from what I would expect from the likes of Map.get/3 -- I would expect the default (i.e. "fallback") value to be the 3rd argument, not the 2nd. This seems a mashing of Map.get/3 and Map.get_lazy/3, no?

Would you be open to discussing the organization and approach of this package? I think it could be adjusted to support releases and help simplify the Mix configs.

@iloveitaly
Copy link
Collaborator

Would you be open to discussing the organization and approach of this package? I think it could be adjusted to support releases and help simplify the Mix configs.

Yes, definitely! Submit a PR and I'll take a look. There are definitely lots of improvements to be made last time I took a look.

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

2 participants