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

Custom variables in settings.json for easier profile configuration #9185

Open
AlexKay88 opened this issue Feb 16, 2021 · 3 comments
Open

Custom variables in settings.json for easier profile configuration #9185

AlexKay88 opened this issue Feb 16, 2021 · 3 comments
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Milestone

Comments

@AlexKay88
Copy link

Description of the new feature/enhancement

Let one define custom variables in settings.json for use with profiles.
E.g. define myCustomVariable for later use within commandline to avoid adding same long path to SSH key file for every profile name.
Would also be great to reuse current profile parameters such as "name" to connect to this hostname by stating $profile.name with SSH as shown in example.

Proposed technical implementation details (optional)

"profiles":
{
    "defaults":
    {
        "myCustomVariable": "C:\\Users\\USERNAME\\SSH_KEY_FILE_PATH.key"
    },
    "list":
    [
        {
            "name": "HOSTNAME",
            "commandline": "ssh -i $myCustomVariable $profile.name", 
        },
@AlexKay88 AlexKay88 added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Feb 16, 2021
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 16, 2021
@zadjii-msft
Copy link
Member

This isn't a terrible idea, but I'm guessing that this would not play well with the Settings UI. So this would end up being a feature that would work well if you exclusively used the json settings. I'm gonna stick this in the freezer for now. It's a reasonable request, but not one we're likely to get to anytime soon.

@zadjii-msft zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. labels Feb 26, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Feb 26, 2021
@zadjii-msft zadjii-msft added this to the Icebox ❄ milestone Feb 26, 2021
@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Feb 26, 2021
@chadleywilson
Copy link

This is dearly required feature for our company now, please take it out the freezer

I have 100s of servers we manage using Windows Terminal
Example of one:

{
                "colorScheme": "Raspberry",
                "commandline": "pwsh.exe -c ssh [email protected]",
                "font": 
                {
                    "size": 10
                },
                "guid": "{5f1b74da-9684-591d-8a8a-bed6171bd000}",
                "hidden": false,
                "icon": "C:\\Scripts\\windows-terminal-icons\\icons\\ubuntu.png",
                "name": "server-01"
            },

Now every time we have a new desk agent or employee in the IT team who needs this file we have to copy to his machine and replace myusername with hisusername

Then as we are big enterprise when this file changes because we have added and removed terminal profiles we have to update everyone and its becoming a massive unpleasant time wasting chore.

How can we define at the top of the settings.json an variable for example sshusername=myusername?

and then have each profile

{
                "colorScheme": "Raspberry",
                "commandline": "pwsh.exe -c ssh ${sshusername}@server-01.domain.net",
                "font": 
                {
                    "size": 10
                },
                "guid": "{5f1b74da-9684-591d-8a8a-bed6171bd000}",
                "hidden": false,
                "icon": "C:\\Scripts\\windows-terminal-icons\\icons\\ubuntu.png",
                "name": "server-01"
            },

This way we could push the settings json file via policy to all the machines and have near zero maintenance.
Below is an indication of our profiles, they are so long they don't fit on the screen

Image

@DHowett
Copy link
Member

DHowett commented Jan 14, 2025

You may not be able to achieve exactly this today, but... it seems much better-served by:

  • ssh_config (to specify the username; configure it once per person and let it be)
  • Terminal fragment extensions, which let your organization deploy a set of JSON profiles which do not require you to edit each user's settings file

This at least prevents you from having to override everyone's settings every time you provision a new server. Plus, ssh_config supports wildcards:

Host *.domain.net
        User myusername

(as an aside: why are you launching PowerShell just to launch ssh? You can launch ssh directly.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

4 participants