Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set environment variables for run command #618

Open
bam80 opened this issue Nov 6, 2020 · 6 comments
Open

set environment variables for run command #618

bam80 opened this issue Nov 6, 2020 · 6 comments
Labels
1. Feature request A request for a new feature

Comments

@bam80
Copy link

bam80 commented Nov 6, 2020

Didn't find a way to do so. Should we add it?

@bam80 bam80 added the 1. Feature request A request for a new feature label Nov 6, 2020
@debarshiray
Copy link
Member

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.

@bam80
Copy link
Author

bam80 commented Dec 18, 2020

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

@debarshiray
Copy link
Member

Ok, yes, sounds like we should it. :)

@jorgeml
Copy link

jorgeml commented Dec 21, 2020

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.

@xfgusta xfgusta mentioned this issue Oct 4, 2021
@bellegarde-c
Copy link

I used a workaround to pass "Gnome-Builder external command" env variables:

toolbox run bash -c "SRCDIR=$SRCDIR flatpak-remote-builder build"

@bmenant
Copy link

bmenant commented Dec 15, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. Feature request A request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants