From 541b025ad0c61f82cc12547a09f17b2938a99d9f Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 4 Dec 2023 12:47:19 +0200 Subject: [PATCH] fix timeserver config loading --- lib/accounts.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/accounts.rb b/lib/accounts.rb index 0f76fe4c..0f6cac94 100644 --- a/lib/accounts.rb +++ b/lib/accounts.rb @@ -75,7 +75,14 @@ module Accounts if Docuseal.multitenant? Docuseal::TIMESERVER_URL else - EncryptedConfig.find_by(account:, key: EncryptedConfig::TIMESTAMP_SERVER_URL_KEY)&.value + url = EncryptedConfig.find_by(account:, key: EncryptedConfig::TIMESTAMP_SERVER_URL_KEY)&.value + + unless Docuseal.multitenant? + url ||= + Account.order(:id).first.encrypted_configs.find_by(key: EncryptedConfig::TIMESTAMP_SERVER_URL_KEY)&.value + end + + url end.presence end