Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'config/environments')
-rw-r--r--config/environments/development.rb37
-rw-r--r--config/environments/production.rb66
-rw-r--r--config/environments/test.rb32
3 files changed, 109 insertions, 26 deletions
diff --git a/config/environments/development.rb b/config/environments/development.rb
index ea9b17981..4342f872a 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,10 +1,12 @@
# frozen_string_literal: true
+require "active_support/core_ext/integer/time"
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
- # In the development environment your application's code is reloaded on
- # every request. This slows down response time but is perfect for development
+ # In the development environment your application's code is reloaded any time
+ # it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
@@ -15,12 +17,14 @@ Rails.application.configure do
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
- if Rails.root.join("tmp", "caching-dev.txt").exist?
+ # Run rails dev:cache to toggle caching.
+ if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
- "Cache-Control" => "public, max-age=#{2.days.seconds.to_i}"
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
@@ -28,6 +32,9 @@ Rails.application.configure do
config.cache_store = :null_store
end
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ # config.active_storage.service = :local
+
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
@@ -36,9 +43,18 @@ Rails.application.configure do
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
@@ -53,13 +69,22 @@ Rails.application.configure do
# Show the logging configuration on STDOUT
config.show_log_configuration = true
- # Raises error for missing translations
- # config.action_view.raise_on_missing_translations = true
+ # Raises error for missing translations.
+ config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
+
+ # Allow the host configured in the diaspora.toml to access the development server
+ config.hosts << AppConfig.pod_uri.host
+
# Speed up asset serving
config.middleware.insert 0, TurboDevAssets
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 13a91a017..ff5ec75b7 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require "active_support/core_ext/integer/time"
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@@ -13,18 +15,22 @@ Rails.application.configure do
config.eager_load = true
config.eager_load_paths += %W[#{config.root}/lib]
+ # diaspora* does not use ActiveStroage. But eager loading then loads active_storage/blob.rb,
+ # which then fails if there isn't a config/storage.yml
+ # This can be removed if we ever want to use ActiveStorage and a storage.yml exists
+ config.eager_load_namespaces.delete(ActiveStorage::Engine)
+
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
- # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
- # `config/secrets.yml.key`.
- config.read_encrypted_secrets = true
+ # 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).
+ # config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
- config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :terser
@@ -33,19 +39,19 @@ Rails.application.configure do
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Generate digests for assets URLs.
- config.assets.digest = true
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
if AppConfig.environment.assets.host.present?
- config.action_controller.asset_host = AppConfig.environment.assets.host.get
+ config.asset_host = AppConfig.environment.assets.host.get
end
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
- # Mount Action Cable outside main process or domain
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ # config.active_storage.service = :local
+
+ # Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
@@ -53,7 +59,8 @@ Rails.application.configure do
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
- # Log level
+ # Include generic and useful information about system operation, but avoid logging too much
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info
# Prepend all log lines with the following tags.
@@ -68,20 +75,34 @@ Rails.application.configure do
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
+ # Use a real queuing backend for Active Job (and separate queues per environment).
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "diaspora_production"
+
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
+ # Log disallowed deprecations.
+ config.active_support.disallowed_deprecation = :log
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
# Use default logging formatter so that PID and timestamp are not suppressed.
# config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
- # require 'syslog/logger'
+ # require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
# if ENV["RAILS_LOG_TO_STDOUT"].present?
@@ -92,4 +113,25 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
+
+ # Inserts middleware to perform automatic connection switching.
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
+ # middleware. The `delay` is used to determine how long to wait after a write
+ # to send a subsequent read to the primary.
+ #
+ # The `database_resolver` class is used by the middleware to determine which
+ # database is appropriate to use based on the time delay.
+ #
+ # The `database_resolver_context` class is used by the middleware to set
+ # timestamps for the last write to the primary. The resolver uses the context
+ # class timestamps to determine how long to wait before reading from the
+ # replica.
+ #
+ # By default Rails will store a last write timestamp in the session. The
+ # DatabaseSelector middleware is designed as such you can define your own
+ # strategy for connection switching and pass that into the middleware through
+ # these configuration options.
+ # config.active_record.database_selector = { delay: 2.seconds }
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 26db9c226..d629f1e6c 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,12 +1,15 @@
# frozen_string_literal: true
+require "active_support/core_ext/integer/time"
+
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
- # The test environment is used exclusively to run your application's
- # test suite. You never need to work with it otherwise. Remember that
- # your test database is "scratch space" for the test suite and is wiped
- # and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
@@ -17,7 +20,7 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
- "Cache-Control" => "public, max-age=#{1.hour.seconds.to_i}"
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
}
# Suppress logger output for asset requests.
@@ -27,7 +30,6 @@ Rails.application.configure do
config.assets.precompile += %w[poltergeist_disable_transition.css]
# Don't precompile all themes for tests
- config.assets.precompile -= %w[color_themes/*/desktop.css color_themes/*/mobile.css]
config.assets.precompile += %w[
color_themes/original/desktop.css
color_themes/dark_green/desktop.css
@@ -39,12 +41,17 @@ Rails.application.configure do
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
+ config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ # config.active_storage.service = :test
+
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
@@ -55,11 +62,20 @@ Rails.application.configure do
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
# Set the logging destination(s)
config.log_to = %w[file]
- # Raises error for missing translations
- # config.action_view.raise_on_missing_translations = true
+ # Raises error for missing translations.
+ config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
# for fixture_builder
ENV["FIXTURES_PATH"] = "spec/fixtures"