riemann / riemann-dash

An HTTP dashboard for Riemann.
MIT License
248 stars 102 forks source link

Config#store is not updated based on configuration #40

Closed haf closed 11 years ago

haf commented 11 years ago

When testing Riemann-dash and configuring a custom ws_config directory - specifically inside a /home/riemann-dash folder, it turned out that the property was not overridable through riemann-dash.rb with a sinatra config.

The reason for this is that #Config lib/riemann/dash/config.rb is initialised as a singleton :(App < Sinatra::Base)#settings instead?, see http://www.sinatrarb.com/contrib/config_file.html https://ididitmyway.herokuapp.com/past/2010/11/9/sinatra_settings_and_configuration/

So this is a 'fix' that doesn't refactor the settings, but keeps Riemann::Dash::Config.

Example output before fix (adding some debug code):

app: self.load called for file /etc/riemann/riemann-dash.rb
setting up default config values, merging config {} with some defaults
loading config from /etc/riemann/riemann-dash.rb: set :bind, '0.0.0.0'
set :port, 4567
set :environment, :production
== Sinatra/1.4.3 has taken the stage on 4567 for production with backup from
Thin
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop

After:

app: self.load called for file /etc/riemann/riemann-dash.rb
setting up default config values, merging config {} with some defaults
loading config from /etc/riemann/riemann-dash.rb: set :bind, '0.0.0.0'
set :port, 4567
set :environment, :production
set :ws_config, '/home/riemann-dash/config/config.json'
setting bind: 0.0.0.0
setting port: 4567
setting environment: production
setting ws_config: /home/riemann-dash/config/config.json
== Sinatra/1.4.3 has taken the stage on 4567 for production with backup from
Thin
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
haf commented 11 years ago

PS: the first output is slightly off (but the problem is there none the less), so ignore the first output.

haf commented 11 years ago

Found the obvious alternative way of setting these properties. Great. (gah!)