Class: App
- Inherits:
-
Object
- Object
- App
- Extended by:
- GLI::App
- Defined in:
- lib/avs.rb,
lib/app.rb,
lib/domain/tag/command.rb,
lib/domain/site/command.rb,
lib/domain/asset/command.rb,
lib/domain/report/command.rb,
lib/domain/country/command.rb,
lib/domain/project/command.rb,
lib/domain/software/command.rb,
lib/domain/asset_group/command.rb,
lib/domain/scan_engine/command.rb,
lib/domain/site_target/command.rb,
lib/domain/scan_schedule/command.rb,
lib/domain/scan_template/command.rb,
lib/domain/vulnerability/command.rb,
lib/domain/operating_system/command.rb,
lib/domain/scan_engine_pool/command.rb,
lib/domain/shared_credential/command.rb
Overview
require_relative ‘../../service/mail’
Class Method Summary collapse
-
.api ⇒ Object
TODO: use the ENV for host, db, port.
- .backtrace(exception, limit: 8, prefix: "\t") ⇒ Object
-
.db ⇒ Object
TODO: use the ENV for host, db, port.
- .mail ⇒ Object
- .nucleus ⇒ Object
- .parent(options, key) ⇒ Object
Class Method Details
.api ⇒ Object
TODO: use the ENV for host, db, port
17 18 19 20 21 22 23 |
# File 'lib/app.rb', line 17 def self.api @api ||= InsightVMApi.new( base_url: ENV['INSIGHTVM_API_URL'], username: ENV['INSIGHTVM_API_USER'], password: ENV['INSIGHTVM_API_PASSWORD'] ) end |
.backtrace(exception, limit: 8, prefix: "\t") ⇒ Object
52 53 54 55 56 57 |
# File 'lib/app.rb', line 52 def self.backtrace(exception, limit: 8, prefix: "\t") puts "#{prefix} Error occurred: #{exception.message}" puts "#{prefix} ----------------------------" puts exception.backtrace.first(limit).map { |line| "\t\t#{line}" }.join("\n") puts "#{prefix} ----------------------------" end |
.db ⇒ Object
TODO: use the ENV for host, db, port
35 36 37 38 39 40 41 42 |
# File 'lib/app.rb', line 35 def self.db @db ||= Db.new( host: ENV['DB_HOST'], db: ENV['DB_NAME'], user: ENV['DB_USER'], port: ENV['DB_PORT'] ) end |
.mail ⇒ Object
44 45 46 |
# File 'lib/app.rb', line 44 def self.mail MailService.instance end |
.nucleus ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/app.rb', line 25 def self.nucleus @nucleus ||= NucleusApi.new( base_url: ENV['NUCLEUS_API_URL'], api_key: ENV['NUCLEUS_API_KEY'], download_dir: ENV['NUCLEUS_DOWNLOAD_DIR'], archive_dir: ENV['NUCLEUS_ARCHIVE_DIR'] ) end |
.parent(options, key) ⇒ Object
48 49 50 |
# File 'lib/app.rb', line 48 def self.parent(, key) [GLI::Command::PARENT][key] end |