Files
netbox-librenms-plugin/.devcontainer/config/codespaces-configuration.py
Vlastislav Svatek 673e67106e
Some checks failed
ci / deploy (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
first commit
2026-06-05 10:39:05 +02:00

31 lines
881 B
Python

# GitHub Codespaces NetBox Configuration
# CSRF/hosts setup for Codespaces URLs
import os
codespace_name = os.environ.get("CODESPACE_NAME")
port_domain = os.environ.get("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN", "app.github.dev")
if codespace_name:
codespaces_url = f"https://{codespace_name}-8000.{port_domain}"
CSRF_TRUSTED_ORIGINS = [
codespaces_url,
"http://localhost:8000",
"http://127.0.0.1:8000",
]
ALLOWED_HOSTS = [
f"{codespace_name}-8000.{port_domain}",
"localhost",
"127.0.0.1",
"*",
]
print(f"🔗 Codespaces detected: {codespace_name}")
print(f"🔒 CSRF Trusted Origins: {CSRF_TRUSTED_ORIGINS}")
print(f"🌐 Allowed Hosts: {ALLOWED_HOSTS}")
else:
CSRF_TRUSTED_ORIGINS = [
"http://localhost:8000",
"http://127.0.0.1:8000",
]
ALLOWED_HOSTS = ["*"]