Class: ConfigServer::App
- Inherits:
-
Object
- Object
- ConfigServer::App
- Defined in:
- lib/config_server/app.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(config_file, logger_output = STDOUT) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(config_file, logger_output = STDOUT) ⇒ App
Returns a new instance of App.
7 8 9 10 11 12 |
# File 'lib/config_server/app.rb', line 7 def initialize(config_file, logger_output = STDOUT) @logger = Logger.new(logger_output) @logger.info "Starting config server with config:" @config = YAML.load_file(config_file) @logger.info @config end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/config_server/app.rb', line 14 def call(env) request_path = env['PATH_INFO'] @logger.info "Got request for #{request_path}" value = get_key_from_yaml(request_path) if value ['200', {'Content-Type' => 'text/plain'}, [value]] else ['404', {'Content-Type' => 'text/plain'}, []] end end |