Skip to content

EJSON support#109

Closed
inner-whisper wants to merge 24 commits into
palkan:masterfrom
inner-whisper:master
Closed

EJSON support#109
inner-whisper wants to merge 24 commits into
palkan:masterfrom
inner-whisper:master

Conversation

@inner-whisper

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

Hi @palkan

Could you review this PR?

@palkan palkan left a comment

Copy link
Copy Markdown
Owner

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.

Comment thread lib/anyway/loaders/ejson.rb Outdated

private

def rel_config_pathes

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread lib/anyway_config.rb Outdated

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

Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread lib/anyway/loaders/ejson.rb Outdated
ejson_parser.call(abs_path),
rel_path
]
end.find { |el| el.itself[0] }

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. Done.

Comment thread lib/anyway/loaders/ejson.rb Outdated

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

palkan commented Mar 6, 2023

Copy link
Copy Markdown
Owner

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
Copy Markdown
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