Module: PluginTool::LocalConfig

Defined in:
lib/local_config.rb

Constant Summary collapse

LOCAL_CONFIG_FILENAME =
"server.config.json"

Class Method Summary collapse

Class Method Details

.get_list(list_name) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/local_config.rb', line 16

def self.get_list(list_name)
  lookup = @@local_config[list_name]
  return [] unless lookup
  list = []
  server_name = PluginTool.get_server_hostname
  list.concat(lookup['*']) if lookup.has_key?('*')
  list.concat(lookup[server_name]) if server_name && lookup.has_key?(server_name)
  list
end

.loadObject



8
9
10
11
12
13
14
# File 'lib/local_config.rb', line 8

def self.load
  if File.exist? LOCAL_CONFIG_FILENAME
    @@local_config = JSON.parse(File.open(LOCAL_CONFIG_FILENAME) { |f| f.read })
  else
    @@local_config = {}
  end
end