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

Support configuring environment via terminal profiles #120366

Closed
Tyriar opened this issue Apr 1, 2021 · 2 comments
Closed

Support configuring environment via terminal profiles #120366

Tyriar opened this issue Apr 1, 2021 · 2 comments
Assignees
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders terminal General terminal issues that don't fall under another label terminal-profiles verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Apr 1, 2021

Suggested in #45444 (comment)

@Tyriar Tyriar added feature-request Request for new features or functionality terminal General terminal issues that don't fall under another label labels Apr 1, 2021
@Tyriar Tyriar added this to the Backlog milestone Apr 1, 2021
@Tyriar Tyriar self-assigned this Apr 1, 2021
@pszlazak
Copy link

pszlazak commented Apr 7, 2021

Using Terminal profiles (introduced via #45444) I managed to prepare dedicated env for terminals in following way:

  • general VS Code config:
    "terminal.integrated.env.linux": {
        "ENVIROMENT": "test"
    },
    "terminal.integrated.profiles.linux": {
        "bash - production": {
            "path": "bash",
            "args": [
                "--rcfile",
                "~/bashrc-prod"
            ],
            "overrideName": true
        },
        "bash - dev": {
            "path": "bash",
            "args": [
                "--rcfile",
                "~/bashrc-dev"
            ],
            "overrideName": true
        },
    },

where terminal.integrated.env.linux sets common variable(s) for all Linux terminals

  • content of ~/bashrc-prod:
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

TYPE=prod
  • content of ~/bashrc-dev:
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

TYPE=dev

In my bash - production I have following variables:

$ echo $ENVIROMENT
test
$ echo $TYPE
prod

In my bash - dev I have following variables:

$ echo $ENVIROMENT
test
$ echo $TYPE
dev

Nevertheless it would be great if something similar to terminal.integrated.env.linux can be used inside definition of profile. E.g.

    "terminal.integrated.env.linux": {
        "ENVIROMENT": "test"
    },
    "terminal.integrated.profiles.linux": {
        "bash - production": {
            "path": "bash",
            "env": [
                "TYPE": "prod"
            ],
            "overrideName": true
        },
        "bash - dev": {
            "path": "bash",
            "env": [
                "TYPE": "dev"
            ],
            "overrideName": true
        },
    },

@Tyriar Tyriar modified the milestones: Backlog, April 2021 Apr 7, 2021
@Tyriar Tyriar closed this as completed in 95c63b6 Apr 7, 2021
@Tyriar
Copy link
Member Author

Tyriar commented Apr 7, 2021

fyi @meganrogge

digitarald pushed a commit that referenced this issue Apr 8, 2021
gjsjohnmurray pushed a commit to gjsjohnmurray/vscode that referenced this issue Apr 8, 2021
@Tyriar Tyriar added the verification-needed Verification of issue is requested label Apr 26, 2021
@alexr00 alexr00 added the verified Verification succeeded label Apr 27, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders terminal General terminal issues that don't fall under another label terminal-profiles verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants
@Tyriar @pszlazak @alexr00 and others