Sha256: 38c1d946d8163f08a90ae8b7f0cccd88d660be6a7f23495dbe9194a48a7056e9

Contents?: true

Size: 961 Bytes

Versions: 3

Compression:

Stored size: 961 Bytes

Contents

# frozen_string_literal: true

module Hotwired
  require "strada"
  require "fileutils"

  class Config
    ROOT  = File.join ENV["HOME"], ".config", "hotwired"
    CRASH = File.join ROOT, "crash"
  end

  FileUtils.mkdir_p Config::ROOT
  CONFIG = Strada.new name: "hotwired", load: "false"

  CONFIG.default.community = "cisco"
  CONFIG.default.db        = File.join Config::ROOT, "hotwired.db"
  CONFIG.default.poll      = %w( 192.168.8.0/24 10.250.8.0/24 )
  CONFIG.default.ignore    = %w( 192.168.8.100 )
  CONFIG.default.mgmt      = %w( lo0.0 loopback0 vlan2 )
  CONFIG.default.threads   = 50
  CONFIG.default.timeout   = 0.25
  CONFIG.default.retries   = 2
  CONFIG.default.log       = File.join Config::ROOT, "log"
  CONFIG.default.debug     = false

  # 加载初始化配置
  CONFIG.load
  CFG       = CONFIG.cfg

  # 初始化项目日志参数
  Log.file  = CFG.log if CFG.log
  Log.level = Logger::INFO
  Log.level = Logger::DEBUG if CFG.debug
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hotwired-0.0.4 lib/hotwired/config.rb
hotwired-0.0.3 lib/hotwired/config.rb
hotwired-0.0.2 lib/hotwired/config.rb