Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code SFTP to multiple servers

In PhpStorm, there is a way to configure multiple SFTP endpoints and chose which server you want to upload to. I'm looking for this functionality in Visual Studio Code. I have installed SFTP VS Code extension and I am able to configure it for one endpoint. What if I want to upload a file to multiple servers? How can I configure that? Or is there another extension that does that?

like image 517
dev.e.loper Avatar asked Nov 27 '22 20:11

dev.e.loper


2 Answers

Hi you can add multiple ftp servers to config. Just The context must not be same.

[
  {
    "name": "server1",
    "context": "/project/build",
    "host": "host",
    "username": "username",
    "password": "password",
    "remotePath": "/remote/project/build"
  },
  {
    "name": "server2",
    "context": "/project/src",
    "host": "host",
    "username": "username",
    "password": "password",
    "remotePath": "/remote/project/src"
  }
]
like image 122
Hasan Veli Soyalan Avatar answered Dec 28 '22 08:12

Hasan Veli Soyalan


You can use "profiles" with the SFTP extension now. https://github.com/liximomo/vscode-sftp#profiles

{
  "name": "My Project",
  "protocol": "sftp",
  "remotePath": "/",
  "port": 22,
  "profiles": {
    "dev": {
      "host": "server1.example.com",
      "username": "username",
      "password": "password"
    },
    "prod": {
      "host": "server2.example.com",
      "username": "other-username",
      "password": "other-password"
    }
  },
  "defaultProfile": "dev"
}
like image 43
WraithKenny Avatar answered Dec 28 '22 10:12

WraithKenny