-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: master
Are you sure you want to change the base?
Conversation
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.
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. 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 |
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.
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 |
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.
@debug | |
options[:debug] |
maybe? I'm not seeing where @debug
is getting set.
@config = Settings.new(Configuration.new(options)) | ||
end | ||
|
||
def debug? | ||
@debug |
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.
Could we just call the debug?
on @config?
@@ -20,6 +20,25 @@ def initialize(static_config) | |||
@static_config = static_config | |||
end | |||
|
|||
def as_json |
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 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.
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.