Revert KHOJ_DOMAIN to only support single domain.

Multiple domain support didn't generalize to other portions where it
is used
This commit is contained in:
Debanjum Singh Solanky 2024-06-24 10:54:12 +05:30
parent 4110e71e84
commit 8fc7f980aa

View file

@ -3,7 +3,6 @@
""" """
from contextlib import redirect_stdout from contextlib import redirect_stdout
import itertools
import logging import logging
import io import io
import os import os
@ -67,13 +66,9 @@ else:
django_app = get_asgi_application() django_app = get_asgi_application()
# Add CORS middleware # Add CORS middleware
KHOJ_DOMAIN = os.getenv("KHOJ_DOMAIN", "app.khoj.dev").split(",") KHOJ_DOMAIN = os.getenv("KHOJ_DOMAIN", "app.khoj.dev")
scheme = "https" if not is_env_var_true("KHOJ_NO_HTTPS") else "http" scheme = "https" if not is_env_var_true("KHOJ_NO_HTTPS") else "http"
custom_origins = list( custom_origins = [f"{scheme}://{KHOJ_DOMAIN.strip()}", f"{scheme}://{KHOJ_DOMAIN.strip()}:*"]
itertools.chain.from_iterable(
[[f"{scheme}://{domain.strip()}", f"{scheme}://{domain.strip()}:*"] for domain in KHOJ_DOMAIN]
)
)
default_origins = [ default_origins = [
"app://obsidian.md", # To allow access from Obsidian desktop app "app://obsidian.md", # To allow access from Obsidian desktop app
"capacitor://localhost", # To allow access from Obsidian iOS app using Capacitor.JS "capacitor://localhost", # To allow access from Obsidian iOS app using Capacitor.JS