Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 25 lines (19 sloc) 0.618 kb
02f8f5a @dj2 add config test
dj2 authored
1 #!/usr/bin/env ruby
d46a4ca @igrigorik some docs within the examples
igrigorik authored
2 $:<< '../lib' << 'lib'
02f8f5a @dj2 add config test
dj2 authored
3
d46a4ca @igrigorik some docs within the examples
igrigorik authored
4 #
5 # Example of using "config/conf_test.rb" during server initialization
6 # - options parser allows us to extend the command line parameters for API
7 # - config file shows loading of environment specific, global, and shared variables
8 #
0f65c91 @dj2 make run without gem installing goliath
dj2 authored
9
02f8f5a @dj2 add config test
dj2 authored
10 require 'goliath'
11
12 class ConfTest < Goliath::API
238228c @igrigorik update conf example
igrigorik authored
13 use Goliath::Rack::Params
ae6ee39 @igrigorik make Render middleware take explicit formats, instead of requiring extra
igrigorik authored
14 use Goliath::Rack::Render, 'json'
02f8f5a @dj2 add config test
dj2 authored
15
e06f0ca @dj2 show options in config
dj2 authored
16 def options_parser(opts, options)
17 options[:test] = 0
18 opts.on('-t', '--test NUM', "The test number") { |val| options[:test] = val.to_i }
19 end
20
02f8f5a @dj2 add config test
dj2 authored
21 def response(env)
22 [200, {}, {:response => env.config}]
23 end
24 end
Something went wrong with that request. Please try again.