From 89adeb6a913b837521df1497f970241e8cd241b1 Mon Sep 17 00:00:00 2001 From: Nicholas Earl Date: Thu, 19 Oct 2023 14:38:35 -0500 Subject: [PATCH] Use bash env substitution for key export --- .github/workflows/build.yaml | 5 +++-- jupyter_server_config_extra.py | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 71f70b4..3654b25 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,8 +26,9 @@ jobs: - name: Export variables for image run: | ls -lrt - echo -e "\nexport CDS_API_KEY=${{ secrets.CDS_API_KEY }}" >> postBuild - less postBuild + export CDS_API_KEY=${{ secrets.CDS_API_KEY }} + cat jupyter_server_config_extra.py | envsubst + less jupyter_server_config_extra.py - name: Build and push the image to quay.io uses: jupyterhub/repo2docker-action@master diff --git a/jupyter_server_config_extra.py b/jupyter_server_config_extra.py index 4efecc0..70d01b1 100644 --- a/jupyter_server_config_extra.py +++ b/jupyter_server_config_extra.py @@ -5,7 +5,7 @@ NB_PATH = Path(hubbleds.__file__).parent / "HubbleDS.ipynb" SERVICE_PREFIX = os.environ["JUPYTERHUB_SERVICE_PREFIX"] - +CDS_API_KEY = "${CDS_API_KEY}" c.ServerProxy.servers = { "hubble": { @@ -27,6 +27,9 @@ ], "absolute_url": False, "launcher_entry": {"title": "Hubble Data Story"}, - "timeout": 15 + "timeout": 15, + "environment": { + "CDS_API_KEY": CDS_API_KEY + } }, } \ No newline at end of file