Natizyskunk / vscode-sftp

Super fast sftp/ftp extension for VS Code
Other
373 stars 68 forks source link

Multiple configurations did not work. #467

Closed TQLeung closed 2 months ago

TQLeung commented 5 months ago

I have the configuration code like below, It seem not work correctly, when I press F1 (SFTP:Sync Local -> Remote),only show an option. I thought it shoud be show two option, but only one. Is there something wrong with my configuration?

image

sftp.json

[
    {
        "name": "RX_Pro_App",
        "host": "app1",
        "protocol": "sftp",
        "port": 22,
        "username": "root",
        "remotePath": "/root/wp/rx",
        "uploadOnSave": false,
        "useTempFile": false,
        "openSsh": false,
        "ignore": [
            ".vscode",
            ".git",
            ".DS_Store",
            "target/**"
        ]
    },
    {
        "name": "RX_Dev",
        "host": "dev",
        "protocol": "sftp",
        "port": 22,
        "username": "root",
        "remotePath": "/root/wp/rx-cloud-backend",
        "uploadOnSave": false,
        "useTempFile": false,
        "openSsh": false,
        "ignore": [
            ".vscode",
            ".git",
            ".DS_Store",
            "target/**"
        ]
    }
]
krmu commented 5 months ago

+1

krmu commented 5 months ago

+1

Try to set context for those hosts. That worked for me.

kleingeo commented 5 months ago

Are contexts paths on meant for the host or local? It isn't clear what they represent.

TQLeung commented 5 months ago

Are contexts paths on meant for the host or local? It isn't clear what they represent.

Contexts path serves local.

TQLeung commented 5 months ago

+1

Try to set context for those hosts. That worked for me. Thanks to answer me。BUT IT IS NOT I NEED。 I need a solution that one FILE PATH upload to two different destinations(2 ip address), and when I press F1,the tool bar shows two options for me。

sickerin commented 5 months ago

@TQLeung I think, the best you can do is to is to setup do multiple profiles. You can switch between the profiles using SFTP: Set Profile, to choose which server you might want to upload by default or on save. Unfortunately, you can't save to both servers, you would need to trigger it manually every time using these image

{
  "profiles": {
    "dev": {
      "host": "dev-host",
      "remotePath": "/dev",
    },
    "prod": {
      "host": "prod-host",
      "remotePath": "/prod"
    }
  },
  "defaultProfile": "dev"
}

You can refer to this other issue https://github.com/Natizyskunk/vscode-sftp/issues/187

sjhsbhqf commented 2 months ago

@TQLeung I think, the best you can do is to is to setup do multiple profiles. You can switch between the profiles using SFTP: Set Profile, to choose which server you might want to upload by default or on save. Unfortunately, you can't save to both servers, you would need to trigger it manually every time using these image

{
  "profiles": {
    "dev": {
      "host": "dev-host",
      "remotePath": "/dev",
    },
    "prod": {
      "host": "prod-host",
      "remotePath": "/prod"
    }
  },
  "defaultProfile": "dev"
}

You can refer to this other issue #187

This instance configuration will prompt that there is no 'name'

TQLeung commented 2 months ago

@TQLeung I think, the best you can do is to is to setup do multiple profiles. You can switch between the profiles using SFTP: Set Profile, to choose which server you might want to upload by default or on save. Unfortunately, you can't save to both servers, you would need to trigger it manually every time using these image

{
  "profiles": {
    "dev": {
      "host": "dev-host",
      "remotePath": "/dev",
    },
    "prod": {
      "host": "prod-host",
      "remotePath": "/prod"
    }
  },
  "defaultProfile": "dev"
}

You can refer to this other issue #187

It works! Brilliant man! Thank you very much!!