Inject binder querystring arg into docker container as an ENV value (original) (raw)
March 27, 2025, 11:45pm 1
Hi everyone. Been banging my head for a while on this, figured one of the experts in this forum might be able help me out and point me in the right direction.
Say we start with a URL similar to this, with a querystring argument at the end:
https://mybinder.org/v2/gh/dbenham/drbbindertest/HEAD?urlpath=%2Fdoc%2Ftree%2FMyNotebook.ipynb?XXXX=1234
In the notebook I’d like to be able to refer to that value like this:os.environ.get('XXXX')
I actually don’t need the value in the notebook, but I want to use it inside the docker container as an argument in an initialization script.
Thanks!
-Dave
rgaiacs March 28, 2025, 7:11am 2
Dear @dbenham,
First, you should only have one ?
as URL query marker.
Second, the way that mybinder.org works is that is forward the URL query to Jupyter Lab.
The best way to support what you want would be to implement it in Jupyter Lab. But I can see some security issues with defining environment variables in the URL.