Class: Cyclid::API::Config

Inherits:
Object
  • Object
show all
Defined in:
app/cyclid/config.rb

Overview

Cyclid API configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/cyclid/config.rb', line 24

def initialize(path)
  config = YAML.load_file(path)
  server = config['server']

  @database = server['database']
  @log = server['log'] || File.join(%w(/ var log cyclid server))
  @dispatcher = server['dispatcher']
  @builder = server['builder']
  @plugins = server['plugins'] || {}
rescue StandardError => ex
  abort "Failed to load configuration file #{path}: #{ex}"
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



22
23
24
# File 'app/cyclid/config.rb', line 22

def builder
  @builder
end

#databaseObject (readonly)

Returns the value of attribute database.



22
23
24
# File 'app/cyclid/config.rb', line 22

def database
  @database
end

#dispatcherObject (readonly)

Returns the value of attribute dispatcher.



22
23
24
# File 'app/cyclid/config.rb', line 22

def dispatcher
  @dispatcher
end

#logObject (readonly)

Returns the value of attribute log.



22
23
24
# File 'app/cyclid/config.rb', line 22

def log
  @log
end

#pluginsObject (readonly)

Returns the value of attribute plugins.



22
23
24
# File 'app/cyclid/config.rb', line 22

def plugins
  @plugins
end