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
import itertools
import logging
import io
import os
@ -67,13 +66,9 @@ else:
django_app = get_asgi_application()
# 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"
custom_origins = list(
itertools.chain.from_iterable(
[[f"{scheme}://{domain.strip()}", f"{scheme}://{domain.strip()}:*"] for domain in KHOJ_DOMAIN]
)
)
custom_origins = [f"{scheme}://{KHOJ_DOMAIN.strip()}", f"{scheme}://{KHOJ_DOMAIN.strip()}:*"]
default_origins = [
"app://obsidian.md", # To allow access from Obsidian desktop app
"capacitor://localhost", # To allow access from Obsidian iOS app using Capacitor.JS