Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
hotfix add rack cors gem and configuration - TODO: rack cors initiali…
Browse files Browse the repository at this point in the history
…zer with env variables and rack attack gem and config
  • Loading branch information
JesusGautamah committed Jan 31, 2023
1 parent 58dff35 commit a81a477
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ gem "activerecord-import"
# Google Firestore
gem "google-cloud-firestore", "~> 2.6"

# Rack Cors
gem "rack-cors"


# Use Sass to process CSS
# gem "sassc-rails"
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ GEM
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.2)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-test (2.0.2)
rack (>= 1.3)
rails (7.0.4.1)
Expand Down Expand Up @@ -378,6 +380,7 @@ DEPENDENCIES
jbuilder (~> 2.11)
pg (~> 1.4)
puma (~> 5.6)
rack-cors
rails (~> 7.0)
rails-controller-testing (~> 1.0)
rspec-rails (~> 6.0)
Expand Down
11 changes: 11 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ class Application < Rails::Application
config.load_defaults 7.0
config.autoload_paths << Rails.root.join("lib")

config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource(
'*',
headers: :any,
methods: [:get, :patch, :put, :delete, :post, :options, :head]
)
end
end

# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
Expand Down
6 changes: 2 additions & 4 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ default: &default
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host: db
username: postgres
password: secret
username: <%= ENV['POSTGRES_USER'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>

development:
<<: *default
Expand All @@ -17,5 +17,3 @@ test:
production:
<<: *default
database: outerspace_blockchain_production
username: outerspace_blockchain
password: <%= ENV["OUTERSPACE_BLOCKCHAIN_DATABASE_PASSWORD"] %>
3 changes: 1 addition & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

Rails.application.configure do
config.hosts << "lvh.me"
config.hosts << "outerspacecoding.com"
config.hosts << "osbc.outerspacecoding.com"
config.hosts << "devtest.outerspacecoding.com"
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded any time
Expand Down

0 comments on commit a81a477

Please sign in to comment.