lib/chronicle/etl/cli/authorizations.rb in chronicle-etl-0.5.5 vs lib/chronicle/etl/cli/authorizations.rb in chronicle-etl-0.6.1
- old
+ new
@@ -1,24 +1,26 @@
# frozen_string_literal: true
require 'sinatra'
require 'launchy'
-require 'pp'
module Chronicle
module ETL
module CLI
# CLI commands for authorizing chronicle-etl with third-party services
class Authorizations < SubcommandBase
default_task 'new'
namespace :authorizations
- desc "authorize", "Authorize with a third-party provider"
+ desc 'authorize', 'Authorize with a third-party provider'
option :port, desc: 'Port to run authorization server on', type: :numeric, default: 4567
- option :credentials, desc: 'Secrets namespace for where to read credentials from (default: PROVIDER)', type: :string, banner: 'NAMESPACE'
- option :secrets, desc: 'Secrets namespace for where authorization should be saved to (default: PROVIDER)', type: :string, banner: 'NAMESPACE'
- option :print, desc: 'Show authorization results (instead of just saving secrets)', type: :boolean, default: false
+ option :credentials, desc: 'Secrets namespace for where to read credentials from (default: PROVIDER)',
+ type: :string, banner: 'NAMESPACE'
+ option :secrets, desc: 'Secrets namespace for where authorization should be saved to (default: PROVIDER)',
+ type: :string, banner: 'NAMESPACE'
+ option :print, desc: 'Show authorization results (instead of just saving secrets)', type: :boolean,
+ default: false
def new(provider)
authorizer_klass = find_authorizer_klass(provider)
credentials = load_credentials(provider: provider, credentials_source: options[:credentials])
authorizer = authorizer_klass.new(port: options[:port], credentials: credentials)
@@ -28,10 +30,10 @@
pp secrets if options[:print]
cli_exit(message: "Authorization saved to '#{secrets_namespace}' secrets")
rescue StandardError => e
- cli_fail(message: "Authorization not successful.\n" + e.message, exception: e)
+ cli_fail(message: "Authorization not successful.\n#{e.message}", exception: e)
end
private
def find_authorizer_klass(provider)