mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-04 20:25:22 +08:00
Rails upgrade fixes [SCI-11841]
This commit is contained in:
parent
a1dcbb4d29
commit
fdefaa85be
3 changed files with 35 additions and 18 deletions
|
@ -39,7 +39,7 @@ RUN \
|
|||
DATABASE_URL=postgresql://postgres@db/scinote_production \
|
||||
SECRET_KEY_BASE=dummy \
|
||||
DEFACE_ENABLED=true \
|
||||
bash -c "rake assets:precompile && rake deface:precompile && rm -rf ./tmp/cache"
|
||||
bash -c "bundle exec rake assets:precompile && bundle exec rake deface:precompile && rm -rf ./tmp/cache"
|
||||
|
||||
# Final stage
|
||||
FROM ruby:3.3-bookworm AS runner
|
||||
|
@ -115,4 +115,4 @@ COPY --from=builder --chown=scinote:scinote $APP_HOME $APP_HOME
|
|||
|
||||
WORKDIR $APP_HOME
|
||||
|
||||
CMD rails s -b 0.0.0.0
|
||||
CMD bin/rails s -b 0.0.0.0
|
||||
|
|
|
@ -29,6 +29,9 @@ module Scinote
|
|||
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
||||
config.autoload_lib(ignore: %w[assets generators tasks])
|
||||
|
||||
# Autoload nested omniauth lib paths
|
||||
config.autoload_paths << Rails.root.join('lib/omniauth/strategies')
|
||||
|
||||
config.add_autoload_paths_to_load_path = true
|
||||
|
||||
# Configuration for the application, engines, and railties goes here.
|
||||
|
@ -42,7 +45,15 @@ module Scinote
|
|||
# Don't generate system test files.
|
||||
config.generators.system_tests = nil
|
||||
|
||||
# Addon autoloading configuration
|
||||
|
||||
# Load custom database adapters from addons
|
||||
Dir.glob(Rails.root.glob('addons/*/lib/active_record/connection_adapters/*.rb')) do |c|
|
||||
Rails.configuration.cache_classes ? require(c) : load(c)
|
||||
end
|
||||
|
||||
Rails.autoloaders.main.ignore(Rails.root.join('addons/*/app/decorators'))
|
||||
Rails.autoloaders.main.ignore(Rails.root.join('addons/*/app/overrides'))
|
||||
|
||||
# Add rack-attack middleware for request rate limiting
|
||||
config.middleware.use Rack::Attack
|
||||
|
|
|
@ -21,26 +21,32 @@ Rails.application.configure do
|
|||
}
|
||||
|
||||
config.action_mailer.default_url_options = { host: Rails.application.routes.default_url_options[:host] }
|
||||
config.action_mailer.default_options = {
|
||||
from: ENV.fetch('MAIL_FROM'),
|
||||
reply_to: ENV.fetch('MAIL_REPLYTO')
|
||||
}
|
||||
|
||||
if ENV['MAIL_FROM'] # don't try and configure if mailing config is not present
|
||||
config.action_mailer.default_options = {
|
||||
from: ENV.fetch('MAIL_FROM'),
|
||||
reply_to: ENV.fetch('MAIL_REPLYTO')
|
||||
}
|
||||
end
|
||||
|
||||
config.action_mailer.perform_deliveries = true
|
||||
config.action_mailer.raise_delivery_errors = true
|
||||
config.action_mailer.delivery_method = ENV['SMTP_USE_AWS_SES'] == 'true' ? :ses : :smtp
|
||||
|
||||
config.action_mailer.smtp_settings = {
|
||||
address: ENV.fetch('SMTP_ADDRESS'),
|
||||
port: ENV.fetch('SMTP_PORT', '587'),
|
||||
domain: ENV.fetch('SMTP_DOMAIN'),
|
||||
authentication: ENV.fetch('SMTP_AUTH_METHOD', 'plain'),
|
||||
enable_starttls_auto: true,
|
||||
user_name: ENV.fetch('SMTP_USERNAME'),
|
||||
password: ENV.fetch('SMTP_PASSWORD'),
|
||||
openssl_verify_mode: ENV.fetch('SMTP_OPENSSL_VERIFY_MODE', 'peer'),
|
||||
ca_path: ENV.fetch('SMTP_OPENSSL_CA_PATH', '/etc/ssl/certs'),
|
||||
ca_file: ENV.fetch('SMTP_OPENSSL_CA_FILE', '/etc/ssl/certs/ca-certificates.crt')
|
||||
}
|
||||
if ENV['SMTP_ADDRESS'] # don't try and configure if SMTP config is not present
|
||||
config.action_mailer.smtp_settings = {
|
||||
address: ENV.fetch('SMTP_ADDRESS'),
|
||||
port: ENV.fetch('SMTP_PORT', '587'),
|
||||
domain: ENV.fetch('SMTP_DOMAIN'),
|
||||
authentication: ENV.fetch('SMTP_AUTH_METHOD', 'plain'),
|
||||
enable_starttls_auto: true,
|
||||
user_name: ENV.fetch('SMTP_USERNAME'),
|
||||
password: ENV.fetch('SMTP_PASSWORD'),
|
||||
openssl_verify_mode: ENV.fetch('SMTP_OPENSSL_VERIFY_MODE', 'peer'),
|
||||
ca_path: ENV.fetch('SMTP_OPENSSL_CA_PATH', '/etc/ssl/certs'),
|
||||
ca_file: ENV.fetch('SMTP_OPENSSL_CA_FILE', '/etc/ssl/certs/ca-certificates.crt')
|
||||
}
|
||||
end
|
||||
|
||||
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
||||
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
||||
|
|
Loading…
Add table
Reference in a new issue