Make encryption config optional for self hosting users (#1476)
* Fix redirect 404 bug * Make encryption optional for self-hosters * Fix test
This commit was merged in pull request #1476.
This commit is contained in:
@@ -5,6 +5,8 @@ module StoreLocation
|
||||
helper_method :previous_path
|
||||
before_action :store_return_to
|
||||
after_action :clear_previous_path
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :handle_not_found
|
||||
end
|
||||
|
||||
def previous_path
|
||||
@@ -12,6 +14,14 @@ module StoreLocation
|
||||
end
|
||||
|
||||
private
|
||||
def handle_not_found
|
||||
if request.fullpath == session[:return_to]
|
||||
session.delete(:return_to)
|
||||
redirect_to fallback_path
|
||||
else
|
||||
head :not_found
|
||||
end
|
||||
end
|
||||
|
||||
def store_return_to
|
||||
if params[:return_to].present?
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
class PlaidItem < ApplicationRecord
|
||||
include Plaidable, Syncable
|
||||
|
||||
encrypts :access_token, deterministic: true
|
||||
if Rails.application.credentials.active_record_encryption.present?
|
||||
encrypts :access_token, deterministic: true
|
||||
end
|
||||
|
||||
validates :name, :access_token, presence: true
|
||||
|
||||
before_destroy :remove_plaid_item
|
||||
|
||||
@@ -30,5 +30,10 @@ module Maybe
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
config.app_mode = (ENV["SELF_HOSTED"] == "true" || ENV["SELF_HOSTING_ENABLED"] == "true" ? "self_hosted" : "managed").inquiry
|
||||
|
||||
# Self hosters can optionally set their own encryption keys if they want to use ActiveRecord encryption.
|
||||
if Rails.application.credentials.active_record_encryption.present?
|
||||
config.active_record.encryption = Rails.application.credentials.active_record_encryption
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,6 +94,4 @@ Rails.application.configure do
|
||||
# ]
|
||||
# Skip DNS rebinding protection for the default health check endpoint.
|
||||
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
||||
|
||||
config.active_record.encryption = Rails.application.credentials.active_record_encryption
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user