mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-09-14 06:58:02 -04:00
* Upgrade application to Rails 8.1 - Update rails gem to ~> 8.1.0 - Set config.load_defaults 8.1 in application.rb - Add gem 'csv' for Ruby 3.4+ compatibility - Replace deprecated 'render text:' with 'render plain:' in PagesController - Add compatibility patch for jsonapi-resources routing in Rails 8.1 - Add compatibility patch for Faraday 2.x error constants - Add Searchkick test stubs for environments without Elasticsearch - Include required Active Storage update migrations Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Remove disabled searchkick * Apply suggestion from @CloCkWeRX * Delete config/initializers/faraday_patch.rb * Apply suggestions from code review Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com> * Remove modifications for tests without elasticsearch * Remove psych gem and its dependencies Removed psych gem version 5.4.0 and its dependencies. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
90 lines
3.1 KiB
Ruby
90 lines
3.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative 'boot'
|
|
|
|
require 'rails/all'
|
|
ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION'] = "true"
|
|
|
|
require 'openssl'
|
|
|
|
# Require the gems listed in Gemfile, including any gems
|
|
# you've limited to :test, :development, or :production.
|
|
Bundler.require(*Rails.groups)
|
|
|
|
module Growstuff
|
|
class Application < Rails::Application
|
|
# Initialize configuration defaults for originally generated Rails version.
|
|
config.load_defaults 8.1
|
|
|
|
# Rails 7.1+ requires a coder for `serialize`.
|
|
# We set YAML as the default for compatibility with gems like Mexican Sofa.
|
|
config.active_record.default_column_serializer = YAML
|
|
|
|
I18n.config.enforce_available_locales = true
|
|
|
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
config.time_zone = 'UTC'
|
|
config.active_record.default_timezone = :local
|
|
|
|
config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone]
|
|
|
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
I18n.load_path += Dir[Rails.root.join("config/locales/*.{rb,yml}")]
|
|
I18n.default_locale = :en
|
|
# rails will fallback to config.i18n.default_locale translation
|
|
config.i18n.fallbacks = true
|
|
# rails will fallback to en, no matter what is set as config.i18n.default_locale
|
|
config.i18n.fallbacks = [:en]
|
|
|
|
# Configure the default encoding used in templates for Ruby 1.9.
|
|
config.encoding = "utf-8"
|
|
|
|
# Configure sensitive parameters which will be filtered from the log file.
|
|
config.filter_parameters += [:password]
|
|
|
|
# Enable escaping HTML in JSON.
|
|
config.active_support.escape_html_entities_in_json = true
|
|
|
|
# Enable the asset pipeline
|
|
config.assets.enabled = true
|
|
|
|
# Version of your assets, change this if you want to expire all your assets
|
|
config.assets.version = '1.0'
|
|
|
|
# Don't try to connect to the database when precompiling assets
|
|
config.assets.initialize_on_precompile = true
|
|
|
|
config.generators do |g|
|
|
g.template_engine :haml
|
|
g.view_specs false
|
|
g.controller_specs false
|
|
g.helper false
|
|
g.stylesheets false
|
|
g.javascripts false
|
|
end
|
|
|
|
# Growstuff-specific configuration variables
|
|
config.currency = 'AUD'
|
|
config.bot_email = ENV.fetch('GROWSTUFF_EMAIL', nil)
|
|
config.user_agent = 'Growstuff'
|
|
config.user_agent_email = "info@growstuff.org"
|
|
|
|
Gibbon::API.api_key = ENV['GROWSTUFF_MAILCHIMP_APIKEY'] || 'notarealkey'
|
|
# API key can't be blank or tests fail
|
|
Gibbon::API.timeout = 10
|
|
Gibbon::API.throws_exceptions = false
|
|
config.newsletter_list_id = ENV.fetch('GROWSTUFF_MAILCHIMP_NEWSLETTER_ID', nil)
|
|
|
|
# config.active_record.raise_in_transactional_callbacks = true
|
|
config.middleware.insert_before 0, Rack::Attack
|
|
|
|
config.middleware.insert_before 0, Rack::Cors do
|
|
allow do
|
|
origins '*'
|
|
resource '/api/v1/*', headers: :any, methods: %i(get options)
|
|
end
|
|
end
|
|
end
|
|
end
|