SFTP


FTP, File Transfer Protocol, is a protocol used to transfer files from a computer to a server or from a server to a computer.

What is it ?

The SFTP plugin aims at integrating the files uploader into the Pipeline stack.

Installation

This plugin is already integrated into the Satellite package, so you can’t require it with the composer.

Usage

Unlike the other plugins, the FTP plugin can only be used to load data.

Building a loader

To build a loader, you need to define a list of servers to which files will be sent and choose which files will be sent.

Configuring your servers

Each server must have a host, a port (optional, use port 21 by default), the username and password to connect to the server and the base_path of the server where the files will be sent.

sftp:
  loader:
    servers:
      - host: 'http://localhost'
        port: 21
        username: 'root'
        password: 'root' 
        base_path: /

It’s possible to activate the passive mode when connecting to a server with the passive_mode option.

sftp:
  loader:
    servers:
      - # ...
        passif_mode: true

Configuring your files

Next, you need to determine the specific path of each file you are going to upload and its content.

sftp:
  loader:
    put:
      - path: my/file/path
        content: 'my_content'

It’s possible to upload only those files that meet a condition using the if option.

sftp:
  loader:
    put:
      - # ...
        if: '@=input["image"] !== null'

Sample configuration

sftp:
  loader:
    servers:
      - host: 'http://localhost'
        port: 21
        username: 'root'
        password: 'root' 
        base_path: /
  put:
    - path: my/file/path
      content: 'my_content'