Module: Rack::Handler::BayServer

Includes:
Baykit::BayServer::Util
Defined in:
lib/rack/handler/bayserver.rb

Constant Summary collapse

ENV_BSERV_HOME =
Baykit::BayServer::BayServer::ENV_BSERV_HOME
ENV_BSERV_PLAN =
Baykit::BayServer::BayServer::ENV_BSERV_PLAN

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.appObject (readonly)

Returns the value of attribute app.



11
12
13
# File 'lib/rack/handler/bayserver.rb', line 11

def app
  @app
end

Class Method Details

.run(app, **options) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rack/handler/bayserver.rb', line 18

def self.run(app, **options)

  @app = app

  port = options[:Port]
  host = options[:Host]
  config = options[:config]
  environment = options[:environment]
  access_log = options[:AccessLog]

  # Get bayserver home from environment
  if StringUtil.set? ENV[ENV_BSERV_HOME]
    bserv_home = ENV[ENV_BSERV_HOME]
  else
    raise "Set #{ENV_BSERV_HOME} environment variable"
  end

  # Get bayserver plan from evironment
  if StringUtil.set? ENV[ENV_BSERV_PLAN]
    bserv_plan = ENV[ENV_BSERV_PLAN]
  else
    bserv_plan = "/tmp/rack.plan"
    plan_str = <<EOF
[harbor]
 grandAgents 4

[port #{port}]
 docker http

[city *]
 [town /]
  [club *]
   docker terminal
EOF
    ::File.write(bserv_plan, plan_str)
  end

  Baykit::BayServer::BayServer.init bserv_home, bserv_plan
  Baykit::BayServer::BayServer.start
end