From adf3b9fcfe4c4407e27c13bc1b5dc87a1776ad0d Mon Sep 17 00:00:00 2001 From: David Glick Date: Sat, 30 Nov 2024 16:43:14 -0300 Subject: [PATCH] set up VHM --- .devcontainer/devcontainer.json | 2 +- setup-codespace.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 setup-codespace.py diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e2f4c4eab1..8fc35c400a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,5 +14,5 @@ }, // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "make install" + "postCreateCommand": "make install && .venv/bin/zconsole run instance/etc/zope.conf setup-codespace.py" } diff --git a/setup-codespace.py b/setup-codespace.py new file mode 100644 index 0000000000..5cf3f48dc3 --- /dev/null +++ b/setup-codespace.py @@ -0,0 +1,9 @@ +import os +import transaction + +CODESPACE_NAME = os.environ.get("CODESPACE_NAME", None) +if CODESPACE_NAME: + DOMAIN = os.environ["GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"] + hostname = f"{CODESPACE_NAME}-8080.{DOMAIN}" + app.virtual_hosting.set_map(f"{hostname}/VirtualHostBase/https/{hostname}:443/VirtualHostRoot") + transaction.commit()