Merge pull request #9601 from adullact/feature-ouidou/disable_certigna_if_not_configured

feat: add env var CERTIGNA_ENABLED to disable certigna if not used
This commit is contained in:
Paul Chavard 2023-10-12 13:43:02 +00:00 committed by GitHub
commit d8b8795ce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View file

@ -9,6 +9,10 @@ class Certigna::API
end
end
def self.enabled?
ENV.fetch("CERTIGNA_ENABLED", "enabled") == "enabled"
end
def self.timestamp(data)
ensure_properly_configured!

View file

@ -8,6 +8,7 @@ class BillSignatureService
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)

View file

@ -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