Fix problem when substituting OAUTH_REDIRECT_URL

This commit is contained in:
Evgeniy Antonyuk 2023-08-11 12:03:18 +05:00
parent a100fdc3e1
commit cb9f62321a

View File

@ -28,7 +28,7 @@ APP_CORE_BASE_DOMAIN = os.environ["APP_CORE_BASE_DOMAIN"] if environ.get("APP_CO
APP_CORE_MACHINEKEY = os.environ["APP_CORE_MACHINEKEY"] if environ.get("APP_CORE_MACHINEKEY") else "your_core_machinekey"
INSTALLATION_TYPE = os.environ["INSTALLATION_TYPE"].upper() if environ.get("INSTALLATION_TYPE") else "ENTERPRISE"
APP_URL_PORTAL = os.environ["APP_URL_PORTAL"] if environ.get("APP_URL_PORTAL") else "http://" + ROUTER_HOST + ":8092"
OAUTH_REDIRECT_URL = os.environ["OAUTH_REDIRECT_URL"] if environ.get("OAUTH_REDIRECT_URL") else "https://service.onlyoffice.com/oauth2.aspx"
OAUTH_REDIRECT_URL = os.environ["OAUTH_REDIRECT_URL"] if environ.get("OAUTH_REDIRECT_URL") else None
APP_STORAGE_ROOT = os.environ["APP_STORAGE_ROOT"] if environ.get("APP_STORAGE_ROOT") else BASE_DIR + "/data/"
APP_KNOWN_PROXIES = os.environ["APP_KNOWN_PROXIES"]
APP_KNOWN_NETWORKS = os.environ["APP_KNOWN_NETWORKS"]
@ -191,11 +191,12 @@ writeJsonFile(filePath, jsonData)
filePath = "/app/onlyoffice/config/autofac.consumers.json"
jsonData = openJsonFile(filePath)
for component in jsonData['components']:
if 'parameters' in component and 'additional' in component['parameters']:
for key, value in component['parameters']['additional'].items():
if re.search(r'.*RedirectUrl$', key) and value:
component['parameters']['additional'][key] = OAUTH_REDIRECT_URL
if OAUTH_REDIRECT_URL:
for component in jsonData['components']:
if 'parameters' in component and 'additional' in component['parameters']:
for key, value in component['parameters']['additional'].items():
if re.search(r'.*RedirectUrl$', key) and value:
component['parameters']['additional'][key] = OAUTH_REDIRECT_URL
writeJsonFile(filePath, jsonData)