summaryrefslogtreecommitdiff
path: root/lib/oxidized/config.rb
diff options
context:
space:
mode:
authorElvin Efendi <elvin.efendiev@shopify.com>2015-12-09 23:43:32 -0500
committerElvin Efendi <elvin.efendiev@shopify.com>2015-12-13 19:02:36 -0500
commit1c4f886e883f947b649613a21955929fa6d7e94c (patch)
treef505d91af55ee18837d0290f3d9ea7ff8531240b /lib/oxidized/config.rb
parent82db9fdd9c135a445a4839e39b245a9965091219 (diff)
refactor and fix bugs introduced with new changes
Diffstat (limited to 'lib/oxidized/config.rb')
-rw-r--r--lib/oxidized/config.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/oxidized/config.rb b/lib/oxidized/config.rb
index 36c1a8f..c850059 100644
--- a/lib/oxidized/config.rb
+++ b/lib/oxidized/config.rb
@@ -12,7 +12,7 @@ module Oxidized
HookDir = File.join Directory, %w(lib oxidized hook)
Sleep = 1
- def self.load
+ def self.load(cmd_opts={})
asetus = Asetus.new(name: 'oxidized', load: false, key_to_s: true)
Oxidized.asetus = asetus
@@ -20,7 +20,7 @@ module Oxidized
asetus.default.password = 'password'
asetus.default.model = 'junos'
asetus.default.interval = 3600
- asetus.default.log = File.join Config::Root, 'log'
+ asetus.default.use_syslog = false
asetus.default.debug = false
asetus.default.threads = 30
asetus.default.timeout = 20
@@ -48,9 +48,10 @@ module Oxidized
raise InvalidConfig, "Error loading config: #{error.message}"
end
- Log.level = Logger::INFO unless asetus.cfg.debug
raise NoConfig, 'edit ~/.config/oxidized/config' if asetus.create
- Log.file = asetus.cfg.log if asetus.cfg.log
+
+ # override if comand line flag given
+ asetus.cfg.debug = cmd_opts[:debug] if cmd_opts[:debug]
asetus
end