Class: Danta::Root
- Inherits:
-
Object
- Object
- Danta::Root
- Defined in:
- lib/danta/root.rb
Instance Method Summary collapse
Instance Method Details
#rack_builder ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/danta/root.rb', line 9 def rack_builder rack = Rack::Builder.new rack.map '/' do run Danta::App.new end rack.map '/api' do run Danta::Api.new end rack end |
#start ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/danta/root.rb', line 23 def start rack = rack_builder danta_host = ENV['DANTA_HOST'] || '0.0.0.0' danta_port = ENV['DANTA_PORT'] || 9292 startup_msg(danta_host, danta_port) Rack::Server.start app: rack, Host: danta_host, Port: danta_port exit end |
#startup_msg(danta_host, danta_port) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/danta/root.rb', line 32 def startup_msg(danta_host, danta_port) p p '=====================================================' p 'Danta app is starting up with the following settings:' p "Host: #{danta_host} # Set DANTA_HOST env var for custom host, defaults on 0.0.0.0" p "Port: #{danta_port} # Set DANTA_PORT env var for custom port, defaults on 9292" p '=====================================================' p end |