mirror of
https://github.com/we-promise/sure
synced 2026-04-25 17:15:07 +02:00
Refactor: Use Encryptable concern in CoinbaseItem (#1339)
Remove the duplicated encryption_ready? method in favor of the Encryptable concern which provides the exact same functionality.
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
class CoinbaseItem < ApplicationRecord
|
||||
include Syncable, Provided, Unlinking
|
||||
include Encryptable
|
||||
|
||||
enum :status, { good: "good", requires_update: "requires_update" }, default: :good
|
||||
|
||||
# Helper to detect if ActiveRecord Encryption is configured for this app
|
||||
def self.encryption_ready?
|
||||
creds_ready = Rails.application.credentials.active_record_encryption.present?
|
||||
env_ready = ENV["ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY"].present? &&
|
||||
ENV["ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY"].present? &&
|
||||
ENV["ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT"].present?
|
||||
creds_ready || env_ready
|
||||
end
|
||||
|
||||
# Encrypt sensitive credentials if ActiveRecord encryption is configured
|
||||
# api_key uses deterministic encryption for querying, api_secret uses standard encryption
|
||||
if encryption_ready?
|
||||
|
||||
Reference in New Issue
Block a user