Skip to content

Commit

Permalink
Merge pull request #9601 from adullact/feature-ouidou/disable_certign…
Browse files Browse the repository at this point in the history
…a_if_not_configured

feat: add env var CERTIGNA_ENABLED to disable certigna if not used
  • Loading branch information
tchak authored Oct 12, 2023
2 parents 5e8d592 + 0fdbfbd commit d8b8795
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/lib/certigna/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
1 change: 1 addition & 0 deletions app/services/bill_signature_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions config/env.example.optional
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d8b8795

Please sign in to comment.