diff --git a/app/lib/certigna/api.rb b/app/lib/certigna/api.rb index e1c6fb7d35c..e49a4f7e559 100644 --- a/app/lib/certigna/api.rb +++ b/app/lib/certigna/api.rb @@ -9,6 +9,10 @@ def self.ensure_properly_configured! end end + def self.enabled? + ENV.fetch("CERTIGNA_ENABLED", "enabled") == "enabled" + end + def self.timestamp(data) ensure_properly_configured! diff --git a/app/services/bill_signature_service.rb b/app/services/bill_signature_service.rb index 797e5bf4b19..7badb339980 100644 --- a/app/services/bill_signature_service.rb +++ b/app/services/bill_signature_service.rb @@ -8,6 +8,7 @@ def self.grouped_unsigned_operation_until(date) end def self.sign_operations(operations, day) + return unless Certigna::API.enabled? bill = BillSignature.build_with_operations(operations, day) signature = Certigna::API.timestamp(bill.digest) bill.set_signature(signature, day) diff --git a/config/env.example.optional b/config/env.example.optional index f22c8389309..e177bf40dc2 100644 --- a/config/env.example.optional +++ b/config/env.example.optional @@ -14,6 +14,9 @@ DS_ENV="staging" # Agent Connect usage # AGENT_CONNECT_ENABLED="disabled" # "enabled" by default +# Certigna usage +# CERTIGNA_ENABLED="disabled" # "enabled" by default + # Configure the maximum number of times a job is retried # MAX_ATTEMPTS_JOBS=25 # MAX_ATTEMPTS_API_ENTREPRISE_JOBS=5