From 94ddad1c9fec1e53d4b2a671901c3c3d4a0b8aef Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Mon, 19 May 2014 11:07:55 +0200 Subject: Add way to show taginfo configuration through web interface. --- web/lib/config.rb | 10 ++++++++++ web/lib/ui/taginfo.rb | 10 ++++++++++ 2 files changed, 20 insertions(+) (limited to 'web/lib') diff --git a/web/lib/config.rb b/web/lib/config.rb index 6195c28..931b639 100644 --- a/web/lib/config.rb +++ b/web/lib/config.rb @@ -19,5 +19,15 @@ class TaginfoConfig return tree.nil? ? default : tree end + # Config without anything that a security concious admin wouldn't want to + # be public. Currently everything that contains local paths is removed. + def self.sanitized_config + c = @@config + c['sources'] && c['sources'].delete('db') + c['logging'] && c['logging'].delete('directory') + c['tagstats'] && c['tagstats'].delete('cxxflags') + return c + end + end diff --git a/web/lib/ui/taginfo.rb b/web/lib/ui/taginfo.rb index e688f82..2d3d6e6 100644 --- a/web/lib/ui/taginfo.rb +++ b/web/lib/ui/taginfo.rb @@ -53,6 +53,16 @@ class Taginfo < Sinatra::Base end end + get '/taginfo/config' do + @title = 'Configuration' + @section = 'taginfo' + @section_title = t.taginfo.meta + + @config = TaginfoConfig.sanitized_config + + erb :'taginfo/config' + end + get '/taginfo/translations' do @title = 'Translations Overview' @section = 'taginfo' -- cgit v1.2.3