Module: Aircana::CLI::DoctorChecks::SQSIntegration
- Included in:
- Aircana::CLI::Doctor
- Defined in:
- lib/aircana/cli/commands/doctor_checks.rb
Instance Method Summary collapse
- #check_sqs_configuration ⇒ Object
- #check_sqs_dependencies ⇒ Object
- #check_sqs_integration ⇒ Object
- #log_sqs_config_details(queue_url, message_template, aws_region) ⇒ Object
- #log_sqs_configuration_remedy ⇒ Object
- #sqs_configured?(queue_url, message_template) ⇒ Boolean
Instance Method Details
#check_sqs_configuration ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/aircana/cli/commands/doctor_checks.rb', line 109 def check_sqs_configuration sqs_queue_url = ENV.fetch("AIRCANA_SQS_QUEUE_URL", nil) = ENV.fetch("AIRCANA_SQS_MESSAGE_TEMPLATE", nil) aws_region = ENV.fetch("AWS_REGION", "us-east-1") if sqs_configured?(sqs_queue_url, ) log_success("SQS Config", "Environment variables configured") log_sqs_config_details(sqs_queue_url, , aws_region) if @verbose else log_info("SQS Config", "Not configured") log_sqs_configuration_remedy end end |
#check_sqs_dependencies ⇒ Object
104 105 106 107 |
# File 'lib/aircana/cli/commands/doctor_checks.rb', line 104 def check_sqs_dependencies check_command("aws", "SQS operations", required: false) check_command("jq", "JSON processing for notifications", required: false) end |
#check_sqs_integration ⇒ Object
97 98 99 100 101 102 |
# File 'lib/aircana/cli/commands/doctor_checks.rb', line 97 def check_sqs_integration Aircana.human_logger.info "\nSQS Integration:" check_sqs_dependencies check_sqs_configuration end |
#log_sqs_config_details(queue_url, message_template, aws_region) ⇒ Object
128 129 130 131 132 133 |
# File 'lib/aircana/cli/commands/doctor_checks.rb', line 128 def log_sqs_config_details(queue_url, , aws_region) log_info(" AIRCANA_SQS_QUEUE_URL", queue_url.length > 50 ? "#{queue_url[0..47]}..." : queue_url) log_info(" AIRCANA_SQS_MESSAGE_TEMPLATE", .length > 40 ? "#{message_template[0..37]}..." : ) log_info(" AWS_REGION", aws_region) end |
#log_sqs_configuration_remedy ⇒ Object
135 136 137 138 139 140 141 |
# File 'lib/aircana/cli/commands/doctor_checks.rb', line 135 def log_sqs_configuration_remedy log_remedy("Set AIRCANA_SQS_QUEUE_URL and AIRCANA_SQS_MESSAGE_TEMPLATE for SQS notifications") log_remedy("Example:") log_remedy(' export AIRCANA_SQS_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/account/queue"') log_remedy(' export AIRCANA_SQS_MESSAGE_TEMPLATE=\'{"text":"{{message}}}\'') log_remedy(' export AWS_REGION="us-east-1" # Optional, defaults to us-east-1') end |
#sqs_configured?(queue_url, message_template) ⇒ Boolean
123 124 125 126 |
# File 'lib/aircana/cli/commands/doctor_checks.rb', line 123 def sqs_configured?(queue_url, ) !queue_url.nil? && !queue_url.empty? && !.nil? && !.empty? end |