Sha256: 37950b61fa0b01169b2549d87c26e2f7cd33803982add857b4e82b67e41b70d9
Contents?: true
Size: 709 Bytes
Versions: 2
Compression:
Stored size: 709 Bytes
Contents
%w{ digest/sha1 json rack }.each { |m| require m } module Murlsh # Serve a JSON subset of the configuration. # # Will include all config keys contained in the config key named config_js. class ConfigServer include HeadFromGet def initialize(config) @config_json = config.reject { |k,v| !config.fetch('config_js', []). include?(k) }.to_json @headers = { 'Content-Type' => 'application/json', 'ETag' => "\"#{Digest::SHA1.hexdigest(@config_json)}\"", 'Last-Modified' => Time.now.httpdate } end # Serve a JSON subset of the configuration. def get(req); Rack::Response.new(@config_json, 200, @headers); end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
murlsh-1.0.0 | lib/murlsh/config_server.rb |
murlsh-0.11.0 | lib/murlsh/config_server.rb |