Skip to content

Commit

Permalink
Remove unneeded code related to CSP config (shakacode#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangarha authored Dec 29, 2022
1 parent 9c729b5 commit 6b6daa6
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions lib/install/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@
RUBY
end

if (csp_config_path = Rails.root.join("config/initializers/content_security_policy.rb")).exist?
say "Make note of webpack-dev-server exemption needed to csp"
insert_into_file csp_config_path, <<-RUBY, after: %(# Rails.application.config.content_security_policy do |policy|)
# # If you are using webpack-dev-server then specify webpack-dev-server host
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
RUBY
end

results = []

Dir.chdir(Rails.root) do
Expand All @@ -78,13 +70,6 @@
results << run("yarn add --dev webpack-dev-server")
end

if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
say "You need to allow webpack-dev-server host as allowed origin for connect-src.", :yellow
say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
say "policy.connect_src :self, :https, \"http://localhost:3035\", \"ws://localhost:3035\" if Rails.env.development?", :yellow
end

unless results.all?
say "Webpacker installation failed 😭 See above for details.", :red
exit 1
Expand Down

0 comments on commit 6b6daa6

Please sign in to comment.