lib/wovn/reverse_proxy/wovnrb.rb in wovn-reverse_proxy-0.0.1 vs lib/wovn/reverse_proxy/wovnrb.rb in wovn-reverse_proxy-0.1.0

- old
+ new

@@ -17,25 +17,31 @@ end private def get_wovn_settings(env) - settings = @setting_keys.each_with_object({}) do |key, params| + @setting_keys.each_with_object({}) do |key, params| env_key = "HTTP_X_WOVN_#{key.upcase}" value = env[env_key] next unless value params[key] = get_appropriate_value(key, value) end - settings.merge('use_proxy' => true) end def get_appropriate_value(key, value) if key == 'query' || key == 'supported_langs' value = value.split(/,/) elsif key == 'test_mode' || key == 'use_proxy' - value = false if value.casecmp 'false' + value = true? value end value + end + + def true?(value) + return true if value.to_s.casecmp('true').zero? + return true if value.to_s.casecmp('on').zero? + return true if value.to_s == '1' + false end end end end