-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
EJSON support #109
EJSON support #109
Conversation
Hi @palkan Could you review this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Please, see the comments.
lib/anyway/loaders/ejson.rb
Outdated
|
||
private | ||
|
||
def rel_config_pathes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def rel_config_pathes | |
def rel_config_paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lib/anyway_config.rb
Outdated
@@ -35,6 +35,7 @@ def loaders | |||
|
|||
# Configure default loaders | |||
loaders.append :yml, Loaders::YAML | |||
loaders.append :ejson, Loaders::EJSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move which
check here? I mean, add ejson
loader iff a ejson
executable is present. This way, we can only check once (and not every time we use the loader).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, sure. It looks like a more performant solution
lib/anyway/loaders/ejson.rb
Outdated
ejson_parser.call(abs_path), | ||
rel_path | ||
] | ||
end.find { |el| el.itself[0] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should merge local and env-specific (or global) data. See, for example, YAML or credentials loader.
So, it could be either [local] + environment
or [local] + global
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Done.
lib/anyway/loaders/ejson.rb
Outdated
|
||
trace!(:ejson, path: relative_config_path) do | ||
config_hash.transform_keys do |key| | ||
if key[0] == "_" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, it should be a parser's responsibility to deal with the keys format. The responsibility of the loader is to pick the right source file path(-s) and generate Anyway Config specific data (traces, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Done.
Hi @palkan ! I don't know, if you got notification from Github about my second review request. Just a small ping =) |
Thanks! Merged via #122. P.S. Can you please provide your name in Russian, so I can mark the task on CultOfMartians as done? (Sorry, it's not clear from transliteration). |
What is the purpose of this pull request?
Implements EJSON support.
Closes #106
What changes did you make? (overview)
Is there anything you'd like reviewers to focus on?
Checklist