Skip to content

Commit

Permalink
feat: enhance ALLOWED_HOSTS and add support for insecure transport lo…
Browse files Browse the repository at this point in the history
…gging
  • Loading branch information
kshitijrajsharma committed Jan 12, 2025
1 parent 33fafa0 commit eced2f3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions backend/aiproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@
default="https://api-prod.raw-data.hotosm.org/v1",
)

ALLOWED_HOSTS = ["localhost", "127.0.0.1", HOSTNAME, gethostbyname(gethostname())]

REMOTE_HOSTNAME = gethostname()

REMOTE_HOST_IP = gethostbyname(REMOTE_HOSTNAME)

ALLOWED_HOSTS = ["localhost", "127.0.0.1", HOSTNAME, REMOTE_HOSTNAME, REMOTE_HOST_IP]

CORS_ALLOW_HEADERS = list(default_headers) + [
"access-token",
]
Expand Down Expand Up @@ -212,8 +218,13 @@

STATIC_ROOT = os.path.join(BASE_DIR, "api_static")

if DEBUG:
logging.info("Enabling oauthlib insecure transport in debug mode")
ALLOW_OAUTHLIB_INSECURE_TRANSPORT = env(
"ALLOW_OAUTHLIB_INSECURE_TRANSPORT", default=False
)


if DEBUG or ALLOW_OAUTHLIB_INSECURE_TRANSPORT:
logging.info("Enabling oauthlib insecure transport")
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"


Expand Down

0 comments on commit eced2f3

Please sign in to comment.