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

Allow configuration via TOML file #167

Merged
merged 2 commits into from
May 29, 2020
Merged

Allow configuration via TOML file #167

merged 2 commits into from
May 29, 2020

Conversation

rslota
Copy link
Contributor

@rslota rslota commented May 28, 2020

No description provided.

@rslota rslota requested review from michalwski and leszke May 28, 2020 00:53
Copy link
Contributor

@michalwski michalwski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for introducing the TOML configuration file. I think that more convenient would be to load the TOML config file first (if present) and allow to override some config options with evn vars. Do you think this is possible and make sense?

After my first review focused mostly on the code, I didn't find anything requiring a change.
It'd be good to add some tests, which as far as I know you are going to do.

lib/mongoose_push/application.ex Outdated Show resolved Hide resolved
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technical review: looks good, one minor question.

The overall impression is that overriding the options is a bit complicated and inconsistent (in the code) but acceptable.

Language check recommended, multiple articles missing and "it's" instead of "its", @goddammit

@@ -1,6 +1,7 @@
use Mix.Config

config :mongoose_push, loglevel: :debug
config :mongoose_push, :logging, level: :error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change debug to error?

Copy link
Contributor Author

@rslota rslota May 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's annoying to deal with sheer volume of debug logs, when developer just wants to enter application's shell and actually see commands you execute. As developer I don't need debug logs more often then I need them, so I prefer to have to enable debug logs explicitly, instead of constantly switching them off ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that ^ :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, now it's explicit. I couldn't find it in the PR description somehow ;-)
It's good to describe such things so they don't look like mistakes.

Copy link
Contributor

@goddammit goddammit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might very well be that "unset" is correct in that context

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@rslota
Copy link
Contributor Author

rslota commented May 28, 2020

Thanks for introducing the TOML configuration file. I think that more convenient would be to load the TOML config file first (if present) and allow to override some config options with evn vars. Do you think this is possible and make sense?

After my first review focused mostly on the code, I didn't find anything requiring a change.
It'd be good to add some tests, which as far as I know you are going to do.

You're right, I haven't though about it. Maybe indeed it would be nice to reverse that. I will give it a bit of time, but this will not be trivial. Confex env configuration is based on original sys.config that get's pretty much destroyed with TOML changes. We would need to preserve somehow original sys.config, and right now I don't see any non-hacky way to do that.
The other way around (like now) works, because, TOML configures based on different, external file, so it doesn't require Confex to work at all.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Co-authored-by: K. Kraus <katarzyna.kraus@erlang-solutions.com>
Co-authored-by: K. Kraus <katarzyna.kraus@erlang-solutions.com>
Co-authored-by: Michał Piotrowski <michal.piotrowski@erlang-solutions.com>
@rslota rslota requested review from michalwski and goddammit May 28, 2020 14:52
@rslota
Copy link
Contributor Author

rslota commented May 29, 2020

@michalwski @leszke It's not easy to override TOML with env variables - to do this in non-hacky way, we would need to rethink the env configuration, as Confex library doesn't work well in such scenario.
That being said, I consider this PR ready to be merged. Please re-review :)

@chrzaszcz chrzaszcz self-requested a review May 29, 2020 12:34
@rslota rslota merged commit 4cc73b9 into master May 29, 2020
@rslota rslota deleted the toml_config branch May 29, 2020 13:00
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

Successfully merging this pull request may close these issues.

5 participants