Better debug info if possible

This commit is contained in:
2018-10-01 15:04:05 -05:00
parent 1d578d17b8
commit 848e39d6d4
2 changed files with 6 additions and 6 deletions
@@ -9,22 +9,22 @@ module Dunlop
app_globals = {} app_globals = {}
if adapter_name = params[:adapter].to_s.scan(/\w+/).first.presence if adapter_name = params[:adapter].to_s.scan(/\w+/).first.presence
return render html: '403 - unauthorized, no adapter engine', status: 403 unless adapter = Panda.adapters[adapter_name] return render html: '403 - unauthorized, no adapter engine', status: 403 unless adapter = Panda.adapters[adapter_name]
app_index = Rails.root.join("public/adapters/#{adapter.url_name}/app/index.html") @app_index = Rails.root.join("public/adapters/#{adapter.url_name}/app/index.html")
#app_globals = adapter.settings # load through request instead. More stable then changing environments #app_globals = adapter.settings # load through request instead. More stable then changing environments
unless Rails.application.config.try(:loose_ember_app_authorization) unless Rails.application.config.try(:loose_ember_app_authorization)
return render html: '403 - unauthorized, no adapter engine permission', status: 403 unless current_user.admin? or can?(:read, adapter.engine) return render html: '403 - unauthorized, no adapter engine permission', status: 403 unless current_user.admin? or can?(:read, adapter.engine)
end end
else else
app_index = Rails.root.join('public/app/index.html') @app_index = Rails.root.join('public/app/index.html')
end end
Rails.logger.info "Loading ember app for path '#/#{params[:rest]}' adapter: '#{params[:adapter].presence || 'main_app'}'" Rails.logger.info "Loading ember app for path '#/#{params[:rest]}' adapter: '#{params[:adapter].presence || 'main_app'}'"
if app_index.exist? if @app_index.exist?
index_html = app_index.read.to_s index_html = @app_index.read.to_s
app_globals[:flash] = flash.to_h if flash.present? app_globals[:flash] = flash.to_h if flash.present?
index_html.sub! 'app_globals={}', "app_globals=#{app_globals.to_json}" if app_globals.present? index_html.sub! 'app_globals={}', "app_globals=#{app_globals.to_json}" if app_globals.present?
render html: index_html.html_safe render html: index_html.html_safe
else else
render html: "App file <tt>#{app_index}</tt> not found".html_safe render html: "App file <tt>#{@app_index.to_s}</tt> not found".html_safe
end end
end end
@@ -1,4 +1,4 @@
h3 h3
span Could not find span Could not find
tt= '/app/index.html' tt= @app_index || '/app/index.html'
span file span file