2019-05-18 16:22:53 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Only check if connection works when server starts, and if WOPI is
|
|
|
|
# enabled
|
2019-05-22 22:36:23 +08:00
|
|
|
if defined?(Rails::Server).present? && ENV['WOPI_ENABLED'] == 'true'
|
2019-05-18 16:22:53 +08:00
|
|
|
missing_vars = []
|
|
|
|
%w(
|
|
|
|
WOPI_TEST_ENABLED WOPI_DISCOVERY_URL WOPI_ENDPOINT_URL USER_SUBDOMAIN
|
|
|
|
WOPI_SUBDOMAIN WOPI_USER_HOST
|
|
|
|
).each do |var_name|
|
|
|
|
missing_vars << var_name if ENV[var_name].blank?
|
|
|
|
end
|
|
|
|
|
2021-07-23 17:56:28 +08:00
|
|
|
unless missing_vars.blank?
|
2019-05-18 16:22:53 +08:00
|
|
|
puts "WARNING: Due to WOPI_ENABLED == 'true', " \
|
|
|
|
"following env. variables MUST also be specified: " \
|
|
|
|
"#{missing_vars.join(', ')}; " \
|
|
|
|
"aborting."
|
|
|
|
abort
|
|
|
|
end
|
|
|
|
end
|