diff --git a/Gemfile b/Gemfile index 1bd5c98..5736afa 100644 --- a/Gemfile +++ b/Gemfile @@ -81,6 +81,7 @@ gem "dotenv" gem "faker" gem "htmlbeautifier" gem "http" +gem "rails_db" gem "sqlite3", "~> 1.4" gem "table_print" gem "simple_form" @@ -94,7 +95,6 @@ group :development do gem "draft_generators" gem "grade_runner" gem "pry-rails" - gem "rails_db" gem "rails-erd" gem "rufo" gem "specs_to_readme" diff --git a/bin/render-start.sh b/bin/render-start.sh index 4a61d7b..e954e5e 100644 --- a/bin/render-start.sh +++ b/bin/render-start.sh @@ -3,4 +3,4 @@ set -o errexit # Ruby on Rails -bundle exec puma -C config/puma.rb +bundle exec rails server diff --git a/config/initializers/rails_db.rb b/config/initializers/rails_db.rb index 83daca3..35d2d4c 100644 --- a/config/initializers/rails_db.rb +++ b/config/initializers/rails_db.rb @@ -1,30 +1,27 @@ if Object.const_defined?('RailsDb') RailsDb.setup do |config| - # # enabled or not - # config.enabled = Rails.env.development? + # only enable the gem if environment variables are set for username and password + if ENV.fetch("RAILS_DB_USERNAME", nil).present? && ENV.fetch("RAILS_DB_PASSWORD", nil).present? + # enable + config.enabled = true - # # automatic engine routes mounting - # config.automatic_routes_mount = true + # automatic engine routes mounting + config.automatic_routes_mount = true - # set tables which you want to hide ONLY - config.black_list_tables = ["ar_internal_metadata"] + # set tables which you want to hide ONLY + config.black_list_tables = ["ar_internal_metadata"] - # set tables which you want to show ONLY - # config.white_list_tables = ['posts', 'comments'] + # Enable http basic authentication + config.http_basic_authentication_enabled = true - # # Enable http basic authentication - # config.http_basic_authentication_enabled = false + # Enable http basic authentication + config.http_basic_authentication_user_name = ENV.fetch("RAILS_DB_USERNAME") - # # Enable http basic authentication - # config.http_basic_authentication_user_name = 'rails_db' - - # # Enable http basic authentication - # config.http_basic_authentication_password = 'password' - - # # Enable http basic authentication - # config.verify_access_proc = proc { |controller| true } - - # # Sandbox mode (only read-only operations) - # config.sandbox = false + # Enable http basic authentication + config.http_basic_authentication_password = ENV.fetch("RAILS_DB_PASSWORD") + else + config.enabled = false + config.automatic_routes_mount = false + end end end diff --git a/render.yaml b/render.yaml index 2a0fcc0..6cee2ab 100644 --- a/render.yaml +++ b/render.yaml @@ -1,7 +1,7 @@ services: - type: web name: my-app-name # the name of this service, you should change this - env: ruby # this app is written in ruby + runtime: ruby # this app is written in ruby plan: free # make sure to set this to free or you'll get billed $$$ buildCommand: "./bin/render-build.sh" # we already created these two files for you startCommand: "./bin/render-start.sh" @@ -12,6 +12,8 @@ services: fromDatabase: name: db property: connectionString + - key: WEB_CONCURRENCY + value: 2 databases: # this section provides some additional database configuration - name: db plan: free