Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add: CSP_CONNECT_SRC="analytics.thape.com.cn ws://127.0.0.1:3000" to .env
Add: ENABLE_DEBUGBAR="true" to .env
  • Loading branch information
Eric-Guo committed Mar 23, 2024
1 parent 3481998 commit 39b3166
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ group :development do
gem "ed25519"
gem "bcrypt_pbkdf"

gem 'debugbar'
# Support cursor / vs code
gem "ruby-lsp", require: false
end
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ GEM
debug (1.9.1)
irb (~> 1.10)
reline (>= 0.3.8)
debugbar (0.2.2)
actioncable
rails
deckar01-task_list (2.3.4)
html-pipeline (~> 2.0)
declarative (0.0.20)
Expand Down Expand Up @@ -1326,6 +1329,7 @@ DEPENDENCIES
dashboards!
date_validator (~> 0.12.0)
debug
debugbar
deckar01-task_list (~> 2.3.1)
disposable (~> 0.6.2)
doorkeeper (~> 5.6.6)
Expand Down
7 changes: 7 additions & 0 deletions app/views/layouts/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,12 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<div class="op-wide-autocomplete-wrapper"></div>
<%= call_hook :view_layouts_base_body_bottom %>
<% if ENV["RAILS_ENV"] == 'development' && ENV["ENABLE_DEBUGBAR"] == 'true' %>
<div id="__debugbar"></div>
<script defer src="/_debugbar/assets/script"></script>
<%= nonced_javascript_tag do %>
window._debugbarConfigOptions = {};
<% end %>
<% end %>
</body>
</html>
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
# config.action_view.annotate_rendered_view_with_filenames = true

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
config.action_cable.disable_request_forgery_protection = true

# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/debugbar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Debugbar.configure do |config|
config.enabled = ENV["ENABLE_DEBUGBAR"] == 'true'
end if Rails.env.development?
2 changes: 1 addition & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
workers OpenProject::Configuration.web_workers
workers OpenProject::Configuration.web_workers unless ENV["RAILS_ENV"] == 'development'

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
Expand Down
4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,10 @@
get "ensure_connection", controller: "oauth_clients", action: :ensure_connection, as: "oauth_clients_ensure_connection"
end

if defined? Debugbar
mount Debugbar::Engine => Debugbar.config.prefix
end

if OpenProject::Configuration.lookbook_enabled?
mount Lookbook::Engine, at: "/lookbook"
end
Expand Down

0 comments on commit 39b3166

Please sign in to comment.