Class: FunApi::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/funapi/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bind: "https://localhost", port: 9292, env: ENV.fetch("RACK_ENV", "development"), workers: nil, tls: {}, rack_app: nil) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/funapi/config.rb', line 7

def initialize(
  bind: "https://localhost",   # Falcon defaults to HTTPS in dev
  port: 9292,
  env: ENV.fetch("RACK_ENV", "development"),
  workers: nil,                # let falcon default; can pass via --count
  tls: {}, # {cert:, key:} if you want to override
  rack_app: nil
)
  @bind = bind
  @port = port
  @env = env
  @workers = workers
  @tls = tls
  @rack_app = rack_app
end

Instance Attribute Details

#bindObject

Returns the value of attribute bind.



5
6
7
# File 'lib/funapi/config.rb', line 5

def bind
  @bind
end

#envObject

Returns the value of attribute env.



5
6
7
# File 'lib/funapi/config.rb', line 5

def env
  @env
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/funapi/config.rb', line 5

def port
  @port
end

#rack_appObject

Returns the value of attribute rack_app.



5
6
7
# File 'lib/funapi/config.rb', line 5

def rack_app
  @rack_app
end

#tlsObject

Returns the value of attribute tls.



5
6
7
# File 'lib/funapi/config.rb', line 5

def tls
  @tls
end

#workersObject

Returns the value of attribute workers.



5
6
7
# File 'lib/funapi/config.rb', line 5

def workers
  @workers
end