update rails. update app config.

This commit is contained in:
snogrammer 2021-03-26 16:13:00 -06:00
parent 86ee5b3016
commit 7969a0e920
13 changed files with 117 additions and 88 deletions

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ yarn-debug.log*
coverage coverage
.env* .env*
.DS_STORE

View File

@ -1,40 +1,40 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (6.1.0) actioncable (6.1.3.1)
actionpack (= 6.1.0) actionpack (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.1.0) actionmailbox (6.1.3.1)
actionpack (= 6.1.0) actionpack (= 6.1.3.1)
activejob (= 6.1.0) activejob (= 6.1.3.1)
activerecord (= 6.1.0) activerecord (= 6.1.3.1)
activestorage (= 6.1.0) activestorage (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.1.0) actionmailer (6.1.3.1)
actionpack (= 6.1.0) actionpack (= 6.1.3.1)
actionview (= 6.1.0) actionview (= 6.1.3.1)
activejob (= 6.1.0) activejob (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.1.0) actionpack (6.1.3.1)
actionview (= 6.1.0) actionview (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
rack (~> 2.0, >= 2.0.9) rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.0) actiontext (6.1.3.1)
actionpack (= 6.1.0) actionpack (= 6.1.3.1)
activerecord (= 6.1.0) activerecord (= 6.1.3.1)
activestorage (= 6.1.0) activestorage (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.1.0) actionview (6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
@ -48,22 +48,22 @@ GEM
kaminari (~> 1.0, >= 1.2.1) kaminari (~> 1.0, >= 1.2.1)
railties (>= 5.2, < 6.2) railties (>= 5.2, < 6.2)
ransack (~> 2.1, >= 2.1.1) ransack (~> 2.1, >= 2.1.1)
activejob (6.1.0) activejob (6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.1.0) activemodel (6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
activerecord (6.1.0) activerecord (6.1.3.1)
activemodel (= 6.1.0) activemodel (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
activestorage (6.1.0) activestorage (6.1.3.1)
actionpack (= 6.1.0) actionpack (= 6.1.3.1)
activejob (= 6.1.0) activejob (= 6.1.3.1)
activerecord (= 6.1.0) activerecord (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
marcel (~> 0.3.1) marcel (~> 1.0.0)
mimemagic (~> 0.3.2) mini_mime (~> 1.0.2)
activesupport (6.1.0) activesupport (6.1.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
@ -86,7 +86,7 @@ GEM
bulma-rails (0.9.1) bulma-rails (0.9.1)
sassc (~> 2.0) sassc (~> 2.0)
coderay (1.1.3) coderay (1.1.3)
concurrent-ruby (1.1.7) concurrent-ruby (1.1.8)
connection_pool (2.2.3) connection_pool (2.2.3)
crass (1.0.6) crass (1.0.6)
css_parser (1.7.1) css_parser (1.7.1)
@ -122,7 +122,7 @@ GEM
actionpack (>= 4.1) actionpack (>= 4.1)
activesupport (>= 4.1) activesupport (>= 4.1)
htmlentities (4.3.4) htmlentities (4.3.4)
i18n (1.8.5) i18n (1.8.9)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
inherited_resources (1.12.0) inherited_resources (1.12.0)
actionpack (>= 5.2, < 6.2) actionpack (>= 5.2, < 6.2)
@ -158,24 +158,23 @@ GEM
activesupport (>= 4) activesupport (>= 4)
railties (>= 4) railties (>= 4)
request_store (~> 1.0) request_store (~> 1.0)
loofah (2.8.0) loofah (2.9.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (0.3.3) marcel (1.0.0)
mimemagic (~> 0.3.2)
method_source (1.0.0) method_source (1.0.0)
mimemagic (0.3.5) mini_mime (1.0.3)
mini_mime (1.0.2) minitest (5.14.4)
mini_portile2 (2.4.0)
minitest (5.14.2)
mock_redis (0.26.0) mock_redis (0.26.0)
msgpack (1.3.3) msgpack (1.3.3)
multi_json (1.15.0) multi_json (1.15.0)
nio4r (2.5.4) nio4r (2.5.7)
nokogiri (1.10.10) nokogiri (1.11.2-x86_64-darwin)
mini_portile2 (~> 2.4.0) racc (~> 1.4)
nokogiri (1.11.2-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.20.1) parallel (1.20.1)
paranoia (2.4.3) paranoia (2.4.3)
@ -198,39 +197,40 @@ GEM
public_suffix (4.0.6) public_suffix (4.0.6)
puma (5.1.1) puma (5.1.1)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.5.2)
rack (2.2.3) rack (2.2.3)
rack-proxy (0.6.5) rack-proxy (0.6.5)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (6.1.0) rails (6.1.3.1)
actioncable (= 6.1.0) actioncable (= 6.1.3.1)
actionmailbox (= 6.1.0) actionmailbox (= 6.1.3.1)
actionmailer (= 6.1.0) actionmailer (= 6.1.3.1)
actionpack (= 6.1.0) actionpack (= 6.1.3.1)
actiontext (= 6.1.0) actiontext (= 6.1.3.1)
actionview (= 6.1.0) actionview (= 6.1.3.1)
activejob (= 6.1.0) activejob (= 6.1.3.1)
activemodel (= 6.1.0) activemodel (= 6.1.3.1)
activerecord (= 6.1.0) activerecord (= 6.1.3.1)
activestorage (= 6.1.0) activestorage (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 6.1.0) railties (= 6.1.3.1)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0) rails-html-sanitizer (1.3.0)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.1.0) railties (6.1.3.1)
actionpack (= 6.1.0) actionpack (= 6.1.3.1)
activesupport (= 6.1.0) activesupport (= 6.1.3.1)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (~> 1.0) thor (~> 1.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (13.0.2) rake (13.0.3)
ransack (2.4.0) ransack (2.4.0)
activerecord (>= 5.2.4) activerecord (>= 5.2.4)
activesupport (>= 5.2.4) activesupport (>= 5.2.4)
@ -340,7 +340,7 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
thor (1.0.1) thor (1.1.0)
tilt (2.0.10) tilt (2.0.10)
tzinfo (2.0.4) tzinfo (2.0.4)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
@ -361,6 +361,7 @@ GEM
PLATFORMS PLATFORMS
x86_64-darwin-18 x86_64-darwin-18
x86_64-darwin-20
x86_64-linux-musl x86_64-linux-musl
DEPENDENCIES DEPENDENCIES

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class BulmaDeviseMailer < Devise::Mailer class BulmaDeviseMailer < Devise::Mailer
default from: App::Config::DEFAULT_EMAIL default from: Rails.configuration.x.smtp_mailer.primary_sender_email
layout 'mailer' layout 'mailer'
end end

View File

@ -3,7 +3,7 @@
<div class="hero-body"> <div class="hero-body">
<div class="container"> <div class="container">
<h1 class="title"> <h1 class="title">
<%= App::Config::APP_TITLE %> <%= App::TITLE %>
</h1> </h1>
<h2 class="subtitle"> <h2 class="subtitle">
My first website with <strong>Bulma</strong>! My first website with <strong>Bulma</strong>!

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title><%= App::Config::APP_TITLE %></title> <title><%= App::TITLE %></title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>

View File

@ -26,7 +26,7 @@
</p> </p>
<p> <p>
By using <%= App::Config::APP_TITLE %>, you acknowledge and agree to the terms of cookie use and other first-party analytics;<br/> By using <%= App::TITLE %>, you acknowledge and agree to the terms of cookie use and other first-party analytics;<br/>
which are used for site performance, development debugging, and other non-nefarious technology improvements. which are used for site performance, development debugging, and other non-nefarious technology improvements.
</p> </p>
</div> </div>

View File

@ -2,7 +2,7 @@
<div class="navbar-brand"> <div class="navbar-brand">
<%= link_to(root_path, class: "navbar-item") do %> <%= link_to(root_path, class: "navbar-item") do %>
<%= fa_stacked_icon("cubes", base: "shield", base_type: :fal) %> <%= fa_stacked_icon("cubes", base: "shield", base_type: :fal) %>
<%= App::Config::APP_TITLE %> <%= App::TITLE %>
<% end %> <% end %>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false"> <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">

View File

@ -22,16 +22,13 @@ require 'sprockets/railtie'
Bundler.require(*Rails.groups) Bundler.require(*Rails.groups)
module App module App
module Config SHORT_NAME = 'app' # TODO: Update name
APP_NAME = 'app' # TODO: Update name TITLE = 'TODO: Update in config/application.rb'
APP_TITLE = 'TODO: Update in config/application.rb'
DATABASE_URL = ENV.fetch('DATABASE_URL') { "postgres://localhost:5432/#{APP_NAME}_#{Rails.env}" }
REDIS_URL = ENV.fetch('REDIS_URL') { 'redis://localhost:6379/0' }
SMTP_HOST = ENV.fetch('SMTP_HOST') { 'localhost' }
SMTP_PORT = ENV.fetch('SMTP_PORT') { 1025 }
end
class Application < Rails::Application class Application < Rails::Application
config.x.redis = config_for(:redis)
config.x.smtp_mailer = config_for(:smtp_mailer)
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0 config.load_defaults 6.0
@ -45,19 +42,19 @@ module App
# System-wide settings # System-wide settings
# mail settings # mail settings
config.action_mailer.default_url_options = { host: App::Config::SMTP_HOST } config.action_mailer.default_url_options = { host: config.x.smtp_mailer.host }
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: App::Config::SMTP_HOST, port: App::Config::SMTP_PORT } config.action_mailer.smtp_settings = { address: config.x.smtp_mailer.host, port: config.x.smtp_mailer.port }
# https://github.com/redis-store/redis-rails#rails-fragment-cache # https://github.com/redis-store/redis-rails#rails-fragment-cache
config.cache_store = :redis_store, App::Config::REDIS_URL, { expires_in: 90.minutes } config.cache_store = :redis_store, config.x.redis.url, { expires_in: 90.minutes }
# https://github.com/mperham/sidekiq/wiki/Active-Job#active-job-setup # https://github.com/mperham/sidekiq/wiki/Active-Job#active-job-setup
config.active_job.queue_adapter = :sidekiq config.active_job.queue_adapter = :sidekiq
# In order for logs to function properly, # In order for logs to function properly,
# Docker expects your application or process to log to STDOUT # Docker expects your application or process to log to STDOUT
logger = ActiveSupport::Logger.new(STDOUT) logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter logger.formatter = config.log_formatter
config.log_tags = %i[subdomain uuid] config.log_tags = %i[subdomain uuid]
config.logger = ActiveSupport::TaggedLogging.new(logger) config.logger = ActiveSupport::TaggedLogging.new(logger)

View File

@ -4,7 +4,7 @@ default: &default
encoding: unicode encoding: unicode
pool: <%= ENV.fetch('DATABASE_CONNECTION_POOL') { 20 } %> pool: <%= ENV.fetch('DATABASE_CONNECTION_POOL') { 20 } %>
url: <%= ENV.fetch('DATABASE_URL') { 'postgres://localhost:5432' } %> url: <%= ENV.fetch('DATABASE_URL') { 'postgres://localhost:5432' } %>
database: <%= ENV.fetch('DATABASE_NAME') { "#{App::Config::APP_NAME}_#{Rails.env}" } %> database: <%= ENV.fetch('DATABASE_NAME') { "#{App::SHORT_NAME}_#{Rails.env}" } %>
development: development:
<<: *default <<: *default

View File

@ -6,7 +6,7 @@ ActiveAdmin.setup do |config|
# Set the title that is displayed on the main layout # Set the title that is displayed on the main layout
# for each of the active admin pages. # for each of the active admin pages.
# #
config.site_title = App::Config::APP_TITLE config.site_title = App::TITLE
## ##
# Arctic Admin # Arctic Admin

14
config/redis.yml Normal file
View File

@ -0,0 +1,14 @@
default: &default
url: <%= ENV.fetch('REDIS_URL', 'redis://localhost:6379/0') %>
development:
<<: *default
test:
<<: *default
staging:
<<: *default
production:
<<: *default

16
config/smtp_mailer.yml Normal file
View File

@ -0,0 +1,16 @@
default: &default
primary_sender_email: 'no-reply@app.com' # TODO: Change email
host: <%= ENV.fetch('SMTP_HOST', 'localhost') %>
port: <%= ENV.fetch('SMTP_PORT', 1025) %>
development:
<<: *default
test:
<<: *default
staging:
<<: *default
production:
<<: *default

Binary file not shown.