Sha256: 5b410c8660661d8865885911ef3b81370506d5feea4e5c7ab5897810f1f3601a

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

#!/usr/bin/env ruby
require 'yaml'
require 'nexpose_ticketing'
require 'nexpose_ticketing/version'
require 'nexpose_ticketing/utilities/nx_logger'
require_relative '../lib/nexpose_ticketing/utilities/config_parser'
require 'nexpose_ticketing/utilities/gem_options'

options = {}
if ARGV.count == 0
  puts 'Ticketing system name required.'
  exit -1
end

system = ARGV.first
config_dir = File.join(File.dirname(__FILE__),
                       '../lib/nexpose_ticketing/config/')
config_path = File.join(config_dir, "#{system}.config")
service_config_path = File.join(config_dir, 'ticket_service.config')

unless File.exists? config_path
  puts "Configuration file could not be found at #{config_path}"
  exit -1
end

# We need to load the general config to get the encryption details location
# This is because the ticket gem uses two configs at a time
ticket_service = YAML.load_file(service_config_path)
enc_path = ticket_service[:encryption_options][:directory]

# Setup CLI Options
config_paths = [config_path, service_config_path]
GemOptions.create_parser
          .with_banner_and_options('nexpose_ticketing service_name')
          .with_configuration_encryption(config_paths, enc_path)
          .with_help_and_version('Nexpose Ticketing', NexposeTicketing::VERSION)
          .parse

# Now we can load the config as normal
service_options = ConfigParser.get_config(config_path, enc_path)

log = NexposeTicketing::NxLogger.instance
log.setup_statistics_collection(service_options[:vendor], 
                                service_options[:product], 
                                NexposeTicketing::VERSION)
log.setup_logging(true, 'info')

current_encoding = Encoding.default_external=Encoding.find('UTF-8')

log.log_message("Current Encoding set to: #{current_encoding}")

# Initialize Ticket Service.
NexposeTicketing.start(service_options)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nexpose_ticketing-1.5.2 bin/nexpose_ticketing