class StickShift::Config

StickShift Config

Allows access to stickshift-node config file.

Reads config entried for the sdk from /etc/ss/stickshift-node.conf and if that is not available then it will read it from conf/stickshift-node.conf within the ruby gem.

Constants

CONF_DIR
CONF_NAME

Public Class Methods

new() click to toggle source
# File lib/stickshift-node/config.rb, line 36
def initialize()
  _linux_cfg = File.join(CONF_DIR,CONF_NAME)
  _gem_cfg = File.join(File.expand_path(File.dirname(__FILE__) + 
        '/../../conf'), CONF_NAME)
  @config_path = File.exists?(_linux_cfg) ? _linux_cfg : _gem_cfg

  begin
    @@global_config = ParseConfig.new(@config_path)
  rescue Errno::EACCES => e
    puts "Could not open config file: #{e.message}"
    exit 253
  end
end

Public Instance Methods

get(name) click to toggle source
# File lib/stickshift-node/config.rb, line 50
def get(name)
  val = @@global_config.get_value(name)
  val.gsub!(%r\\:/,":") if not val.nil?
  val.gsub!(%r[ \t]*#[^\n]*/,"") if not val.nil?
  val = val[1..-2] if not val.nil? and val.start_with? "\""
  val
end