29 lines
633 B
Ruby
29 lines
633 B
Ruby
#!/usr/bin/env ruby
|
|
|
|
# frozen_string_literal: true
|
|
|
|
require File.expand_path('../../config/environment', __FILE__)
|
|
|
|
class Mailer
|
|
extend GLI::App
|
|
|
|
program_desc 'Notification Hub'
|
|
|
|
flag :config, desc: 'Path to mailer config file', default_value: 'config/mailer.yml'
|
|
|
|
command :stop do |c|
|
|
c.action do
|
|
end
|
|
end
|
|
|
|
command :run do |c|
|
|
c.desc 'Run processing email events'
|
|
c.action do |global_options, _options, _args|
|
|
config = YAML.load_file(global_options[:config]).deep_symbolize_keys
|
|
EventMailer.call(config[:events], config[:exchanges], config[:keychain])
|
|
end
|
|
end
|
|
end
|
|
|
|
exit Mailer.run(ARGV)
|