Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cache hash configuration cannot be applied #49

Closed
jklimke opened this issue Oct 19, 2020 · 3 comments
Closed

Cache hash configuration cannot be applied #49

jklimke opened this issue Oct 19, 2020 · 3 comments
Assignees
Labels

Comments

@jklimke
Copy link
Contributor

jklimke commented Oct 19, 2020

What did you do?

Tried to configure cache with expires_in value

What did you expect to happen?

Configuration with setting

cache: 
  expires_in: 60

should be loaded from yml file and assigned to the 'cache' key in config which defaults to false.

What actually happened?

Since the cache value is initializes as 'false' value, before loading and merging the yml file, anyway tries to assing hash values to 'false' object.

Possible solution could be to initialize the cache attribute of config to {enabled: false} or to fix anyway config to cope with those issues.

Additional context

backtrace:

     NoMethodError:
       undefined method `[]=' for false:FalseClass
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/tracing.rb:56:in `block in merge_values'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/tracing.rb:52:in `each'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/tracing.rb:52:in `merge_values'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/tracing.rb:54:in `block in merge_values'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/tracing.rb:52:in `each'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/tracing.rb:52:in `merge_values'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/tracing.rb:174:in `trace!'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/anyway/loaders/yaml.rb:13:in `call'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/loaders/base.rb:10:in `call'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/config.rb:324:in `block in load_from_sources'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/loaders.rb:55:in `each'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/loaders.rb:55:in `each'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/config.rb:323:in `load_from_sources'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/config.rb:291:in `block in load'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/tracing.rb:132:in `capture'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/config.rb:288:in `load'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/bundler/gems/influxer-18eb16522ad5/lib/influxer/config.rb:37:in `load'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/gems/anyway_config-2.0.6/lib/.rbnext/2.8/anyway/config.rb:270:in `initialize'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/bundler/gems/influxer-18eb16522ad5/lib/influxer.rb:25:in `new'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/bundler/gems/influxer-18eb16522ad5/lib/influxer.rb:25:in `config'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/bundler/gems/influxer-18eb16522ad5/lib/influxer/client.rb:9:in `initialize'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/bundler/gems/influxer-18eb16522ad5/lib/influxer.rb:33:in `new'
     # /Users/jklimke/.rvm/gems/ruby-2.7.1/bundler/gems/influxer-18eb16522ad5/lib/influxer.rb:33:in `client'

Environment

Ruby Version:

2.7.1
Influxer Version:

@AlexanderShvaykin
Copy link
Collaborator

Thanks! I will try to fix this soon. In the meantime, you can apply the "hack" by explicitly specifying Influxer.config.cache = {...} after loading the configuration. 🤔

@jklimke
Copy link
Contributor Author

jklimke commented Oct 19, 2020 via email

@jklimke
Copy link
Contributor Author

jklimke commented Oct 20, 2020

just saw that you already started to fix the issue in a different branch. The solution might actually be better than mine. I guess that the pull request is not necessary anymore

AlexanderShvaykin added a commit that referenced this issue Oct 27, 2020
Fix issue #49 Fix configuration cache options
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants