Skip to content

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

Open

Description

@AlexKay88

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", 
        },

Activity

  1. added
    Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.
    on Feb 16, 2021
  2. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Feb 16, 2021
  3. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Feb 16, 2021
  4. zadjii-msft commented on Feb 26, 2021

    @zadjii-msft
    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.

  5. ghost removed
    Needs-Tag-FixDoesn't match tag requirements
    on Feb 26, 2021
  6. removed
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Feb 26, 2021
  7. DHowett commented on Jan 14, 2025

    @DHowett
    Member

    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.)

  8. DHowett commented on Jan 18, 2025

    @DHowett
    Member

    Oh! I get it.

    I think SSHADMIN will work as expected if you use the Windows shell syntax for environment variables: %SSHADMIN%.

    ($env: is of course PowerShell specific; % works everywhere else on Windows.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-SettingsIssues related to settings and customizability, for console or terminalIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions