File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "image" : " mcr.microsoft.com/devcontainers/python:1-3.11-bookworm" ,
3+ "postCreateCommand" : " /bin/bash -c 'python -m pip install poetry && python -m poetry install & git clone https://github.com/reflex-dev/reflex-examples; wait'" ,
4+ "forwardPorts" : [3000 , 8000 ],
5+ "portsAttributes" : {
6+ "3000" : {
7+ "label" : " Frontend" ,
8+ "onAutoForward" : " notify"
9+ },
10+ "8000" : {
11+ "label" : " Backend"
12+ }
13+ }
14+ }
Original file line number Diff line number Diff line change @@ -314,6 +314,18 @@ def _replace_defaults(self, **kwargs):
314314 ):
315315 self .deploy_url = f"http://localhost:{ kwargs ['frontend_port' ]} "
316316
317+ # If running in Github Codespaces, override API_URL
318+ codespace_name = os .getenv ("CODESPACE_NAME" )
319+ if "api_url" not in self ._non_default_attributes and codespace_name :
320+ GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN = os .getenv (
321+ "GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"
322+ )
323+ if codespace_name :
324+ self .api_url = (
325+ f"https://{ codespace_name } -{ kwargs .get ('backend_port' , self .backend_port )} "
326+ f".{ GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN } "
327+ )
328+
317329 def _set_persistent (self , ** kwargs ):
318330 """Set values in this config and in the environment so they persist into subprocess.
319331
You can’t perform that action at this time.
0 commit comments