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

EJSON support #109

Closed
wants to merge 24 commits into from
Closed

EJSON support #109

wants to merge 24 commits into from

Conversation

inner-whisper
Copy link
Contributor

@inner-whisper inner-whisper commented Jan 14, 2023

What is the purpose of this pull request?

Implements EJSON support.

Closes #106

What changes did you make? (overview)

  • adds EJSON loader

Is there anything you'd like reviewers to focus on?

Checklist

  • I've added tests for this change
  • I've added a Changelog entry
  • I've updated a documentation

@inner-whisper inner-whisper marked this pull request as ready for review January 14, 2023 15:30
@inner-whisper
Copy link
Contributor Author

Hi @palkan

Could you review this PR?

Copy link
Owner

@palkan palkan 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 the PR!

Please, see the comments.


private

def rel_config_pathes
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
def rel_config_pathes
def rel_config_paths

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -35,6 +35,7 @@ def loaders

# Configure default loaders
loaders.append :yml, Loaders::YAML
loaders.append :ejson, Loaders::EJSON
Copy link
Owner

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).

Copy link
Contributor Author

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

ejson_parser.call(abs_path),
rel_path
]
end.find { |el| el.itself[0] }
Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Done.


trace!(:ejson, path: relative_config_path) do
config_hash.transform_keys do |key|
if key[0] == "_"
Copy link
Owner

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.).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. Done.

@inner-whisper inner-whisper requested a review from palkan January 18, 2023 13:45
@inner-whisper
Copy link
Contributor Author

Hi @palkan !

I don't know, if you got notification from Github about my second review request. Just a small ping =)

@palkan palkan mentioned this pull request Mar 6, 2023
@palkan
Copy link
Owner

palkan commented Mar 6, 2023

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).

@palkan palkan closed this Mar 6, 2023
@palkan palkan mentioned this pull request Mar 6, 2023
@inner-whisper
Copy link
Contributor Author

@palkan

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).

Thank you!

Yep, my name in Russian is "Максим Рыдкин"

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.

EJSON support
2 participants