adjust for multitenant

This commit is contained in:
Alex Turchyn
2023-06-30 20:31:17 +03:00
parent c904d51302
commit f5caed502f
24 changed files with 139 additions and 52 deletions
+10 -1
View File
@@ -5,13 +5,22 @@ module Docuseal
PRODUCT_NAME = 'DocuSeal'
DEFAULT_APP_URL = 'http://localhost:3000'
CERTS = JSON.parse(ENV.fetch('CERTS', '{}'))
DEFAULT_URL_OPTIONS = {
host: ENV.fetch('HOST', 'localhost'),
protocol: ENV['FORCE_SSL'] == 'true' ? 'https' : 'http'
}.freeze
module_function
def multitenant?
ENV['MULTITENANT'] == true
ENV['MULTITENANT'] == 'true'
end
def default_url_options
return DEFAULT_URL_OPTIONS if multitenant?
@default_url_options ||= begin
value = EncryptedConfig.find_by(key: EncryptedConfig::APP_URL_KEY)&.value
value ||= DEFAULT_APP_URL