set environment variables for run command
Didn't find a way to do so. Should we add it?
What's the use-case?
The idea behind the run command was to enable people to write their own desktop files for graphical applications installed inside Toolbox containers. Usually desktop files don't set ad hoc environment variables.
In my case, I need to pass proper QT_QPA_PLATFORM to run as X11 or Wayland client.
I worked out this Exec line for my .desktop file on host but need yet to make sure it works:
Exec=env QT_QPA_PLATFORM=xcb toolbox -c kde.f33 run ~/Charm/Charm/charmtimetracker
Ok, yes, sounds like we should it. :)
In addition to single environment variables, would it be possible to support an environment file parameter with more than one variable please? Similar to what "podman exec --env-file" does. My use case is restic backups, which require a bunch of variables to be passed to define the repository, etc.
I used a workaround to pass "Gnome-Builder external command" env variables:
toolbox run bash -c "SRCDIR=$SRCDIR flatpak-remote-builder build"
More specific toolbox containers would also benefit from those envs, since some devtools prefix commands with various environment variables to execute tests, compilation, linting, debugging session, etc.
For example, to start the NodeJS debugger, Webstorm (Jetbrains’ IDE) uses the following envs (and probably more):
NODE_OPTIONS: '--require /home/***/.local/share/JetBrains/Toolbox/apps/webstorm/plugins/javascript-debugger/debugConnector.js',
JB_IDE_PORT: '43961',
JB_INTERPRETER: '/usr/bin/node',
JB_IDE_HOST: '127.0.0.1',
_JETBRAINS_TEST_RUNNER_RUN_SCOPE_TYPE: 'test',
When node is actually a toolbox run --container node node "$@", those envs are not available to the node runtime and the Debugger is not started.