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

Adding solr_wrapper --debug option #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Adding solr_wrapper --debug option #134

wants to merge 1 commit into from

Conversation

jeremyf
Copy link

@jeremyf jeremyf commented Mar 24, 2020

Prior to this commit, it was somewhat opaque what was used in the Solr
Wrapper work. This change will provide a way to gain insight into the
configuration options that would run.

Prior to this commit, it was somewhat opaque what was used in the Solr
Wrapper work. This change will provide a way to gain insight into the
configuration options that would run.
Copy link
Owner

@cbeer cbeer 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. I've added some thoughts for discussion in the code.

@@ -98,6 +102,11 @@ end

instance = SolrWrapper.instance(options)

if instance.debug?
puts instance.as_json
Copy link
Owner

Choose a reason for hiding this comment

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

What's the use case for this data? I'm imagining it's a person who will do something with it, and does not need to be machine actionable?

If that's the case, I have a mild preference for a) outputing to stderr, b) using a non-json format (YAML, I guess, might make sense.. and would let us align with the on-disk configuration?), and c) not exit, but continue onto the requested command. I also wonder what the relationship between this flag and --verbose should be.

If there's some machine-actionable use, I'd prefer we not use debug as flag, and instead add named subcommand (e.g. "print-config" or similar).

@options = load_configs(Array(options[:config])).merge(options)
end

def debug?
@debug
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
@debug
options[:debug]

maybe? I'm not seeing where @debug is getting set.

@config = Settings.new(Configuration.new(options))
end

def debug?
@debug
Copy link
Owner

Choose a reason for hiding this comment

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

Could we just call the debug? on @config?

@@ -20,6 +20,25 @@ def initialize(static_config)
@static_config = static_config
end

def as_json
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 as_json
def to_h

I don't think json-ness is necessary, and I could see this being reused to dump out an example yml config or something.

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.

2 participants