Skip to content

Commit

Permalink
chore(circle): update circle config
Browse files Browse the repository at this point in the history
  • Loading branch information
trs committed May 18, 2018
1 parent c003592 commit 14910ef
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 130 deletions.
130 changes: 54 additions & 76 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,65 @@
version: 2
jobs:
build_node_8:
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: npm-install-node-8-{{ checksum "package.json" }}
- run:
name: Install
command: npm install
- save_cache:
key: npm-install-node-8-{{ checksum "package.json" }}
paths:
- node_modules

build_node_6:
docker:
- image: circleci/node:6
steps:
- checkout
- restore_cache:
key: npm-install-node-6-{{ checksum "package.json" }}
- run:
name: Install
command: npm install
- save_cache:
key: npm-install-node-6-{{ checksum "package.json" }}
paths:
- node_modules
create-cache-file: &create-cache-file
run:
name: Setup cache
command: echo "$NODE_VERSION" > _cache_node_version

package-json-cache: &package-json-cache
key: npm-install-{{ checksum "_cache_node_version" }}-{{ checksum "package-lock.json" }}

lint:
base-build: &base-build
steps:
- checkout
- <<: *create-cache-file
- restore_cache:
<<: *package-json-cache
- run:
name: Install
command: npm install
- save_cache:
<<: *package-json-cache
paths:
- node_modules
- run:
name: Lint
command: npm run verify:js
- run:
name: Test
command: npm run test:unit:once

jobs:
test_node_10:
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: npm-install-node-8-{{ checksum "package.json" }}
- run:
name: Lint
command: npm run verify:js
- image: circleci/node:10
environment:
- NODE_VERSION: 10
<<: *base-build

test_node_8:
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: npm-install-node-8-{{ checksum "package.json" }}
- run:
name: Test Node 8
command: npm run test:unit:once
when: always
environment:
- NODE_VERSION: 8
<<: *base-build

test_node_6:
docker:
- image: circleci/node:6
steps:
- checkout
- restore_cache:
key: npm-install-node-6-{{ checksum "package.json" }}
- run:
name: Test Node 6
command: npm run test:unit:once
when: always
environment:
- NODE_VERSION: 6
<<: *base-build

release:
docker:
- image: circleci/node:8
environment:
- NODE_VERSION: 8
steps:
- checkout
- <<: *create-cache-file
- restore_cache:
key: npm-install-node-6-{{ checksum "package.json" }}
<<: *package-json-cache
- run:
name: Update NPM
command: |
Expand All @@ -86,45 +74,35 @@ workflows:
version: 2
test_and_tag:
jobs:
- build_node_8:
- test_node_10:
filters:
branches:
only: master
- build_node_6:
- test_node_8:
filters:
branches:
only: master
- lint:
requires:
- build_node_8
- test_node_6:
requires:
- build_node_6
- test_node_8:
requires:
- build_node_8
filters:
branches:
only: master
- release:
requires:
- lint
- test_node_6
- test_node_8
- test_node_10

build_and_test:
jobs:
- build_node_8:
- test_node_10:
filters:
branches:
ignore: master
- build_node_6:
- test_node_8:
filters:
branches:
ignore: master
- lint:
requires:
- build_node_8
- test_node_6:
requires:
- build_node_6
- test_node_8:
requires:
- build_node_8
filters:
branches:
ignore: master
102 changes: 49 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
</a>

<a href="https://circleci.com/gh/trs/ftp-srv">
<img alt="npm" src="https://img.shields.io/circleci/project/github/trs/ftp-srv.svg?style=for-the-badge" />
</a>

<a href="https://coveralls.io/github/trs/ftp-srv?branch=master">
<img alt="npm" src="https://img.shields.io/coveralls/github/trs/ftp-srv.svg?style=for-the-badge" />
<img alt="circleci" src="https://img.shields.io/circleci/project/github/trs/ftp-srv.svg?style=for-the-badge" />
</a>
</p>

Expand All @@ -46,7 +42,7 @@
- Promise based API

## Install
`npm install ftp-srv --save`
`npm install ftp-srv --save`

## Usage

Expand All @@ -67,49 +63,49 @@ ftpServer.listen()

### `new FtpSrv(url, [{options}])`
#### url
[URL string](https://nodejs.org/api/url.html#url_url_strings_and_url_objects) indicating the protocol, hostname, and port to listen on for connections.
[URL string](https://nodejs.org/api/url.html#url_url_strings_and_url_objects) indicating the protocol, hostname, and port to listen on for connections.
Supported protocols:
- `ftp` Plain FTP
- `ftps` Implicit FTP over TLS
- `ftps` Implicit FTP over TLS

_Note:_ The hostname must be the external IP address to accept external connections. Setting the hostname to `0.0.0.0` will automatically set the external IP.
_Note:_ The hostname must be the external IP address to accept external connections. Setting the hostname to `0.0.0.0` will automatically set the external IP.
__Default:__ `"ftp://127.0.0.1:21"`

#### options

##### `pasv_range`
A starting port (eg `8000`) or a range (eg `"8000-9000"`) to accept passive connections.
This range is then queried for an available port to use when required.
A starting port (eg `8000`) or a range (eg `"8000-9000"`) to accept passive connections.
This range is then queried for an available port to use when required.
__Default:__ `22`

##### `greeting`
A human readable array of lines or string to send when a client connects.
A human readable array of lines or string to send when a client connects.
__Default:__ `null`

##### `tls`
Node [TLS secure context object](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) used for implicit (`ftps` protocol) or explicit (`AUTH TLS`) connections.
Node [TLS secure context object](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) used for implicit (`ftps` protocol) or explicit (`AUTH TLS`) connections.
__Default:__ `false`

##### `anonymous`
If true, will allow clients to authenticate using the username `anonymous`, not requiring a password from the user.
Can also set as a string which allows users to authenticate using the username provided.
The `login` event is then sent with the provided username and `@anonymous` as the password.
If true, will allow clients to authenticate using the username `anonymous`, not requiring a password from the user.
Can also set as a string which allows users to authenticate using the username provided.
The `login` event is then sent with the provided username and `@anonymous` as the password.
__Default:__ `false`

##### `blacklist`
Array of commands that are not allowed.
Response code `502` is sent to clients sending one of these commands.
__Example:__ `['RMD', 'RNFR', 'RNTO']` will not allow users to delete directories or rename any files.
Array of commands that are not allowed.
Response code `502` is sent to clients sending one of these commands.
__Example:__ `['RMD', 'RNFR', 'RNTO']` will not allow users to delete directories or rename any files.
__Default:__ `[]`

##### `whitelist`
Array of commands that are only allowed.
Response code `502` is sent to clients sending any other command.
Array of commands that are only allowed.
Response code `502` is sent to clients sending any other command.
__Default:__ `[]`

##### `file_format`
Sets the format to use for file stat queries such as `LIST`.
__Default:__ `"ls"`
Sets the format to use for file stat queries such as `LIST`.
__Default:__ `"ls"`
__Allowable values:__
- `ls` [bin/ls format](https://cr.yp.to/ftp/list/binls.html)
- `ep` [Easily Parsed LIST format](https://cr.yp.to/ftp/list/eplf.html)
Expand All @@ -130,9 +126,9 @@ on('login', ({connection, username, password}, resolve, reject) => { ... });

Occurs when a client is attempting to login. Here you can resolve the login request by username and password.

`connection` [client class object](src/connection.js)
`username` string of username from `USER` command
`password` string of password from `PASS` command
`connection` [client class object](src/connection.js)
`username` string of username from `USER` command
`password` string of password from `PASS` command
`resolve` takes an object of arguments:
- `fs`
- Set a custom file system class for this connection to use.
Expand All @@ -157,8 +153,8 @@ on('client-error', ({connection, context, error}) => { ... });

Occurs when an error arises in the client connection.

`connection` [client class object](src/connection.js)
`context` string of where the error occured
`connection` [client class object](src/connection.js)
`context` string of where the error occured
`error` error object

### `RETR`
Expand Down Expand Up @@ -186,9 +182,9 @@ Occurs when a file is uploaded.
See the [command registry](src/commands/registration) for a list of all implemented FTP commands.

## File System
The default [file system](src/fs.js) can be overwritten to use your own implementation.
This can allow for virtual file systems, and more.
Each connection can set it's own file system based on the user.
The default [file system](src/fs.js) can be overwritten to use your own implementation.
This can allow for virtual file systems, and more.
Each connection can set it's own file system based on the user.

The default file system is exported and can be extended as needed:
```js
Expand All @@ -209,52 +205,52 @@ Custom file systems can implement the following variables depending on the devel

### Methods
#### [`currentDirectory()`](src/fs.js#L29)
Returns a string of the current working directory
Returns a string of the current working directory
__Used in:__ `PWD`

#### [`get(fileName)`](src/fs.js#L33)
Returns a file stat object of file or directory
#### [`get(fileName)`](src/fs.js#L33)
Returns a file stat object of file or directory
__Used in:__ `LIST`, `NLST`, `STAT`, `SIZE`, `RNFR`, `MDTM`

#### [`list(path)`](src/fs.js#L39)
Returns array of file and directory stat objects
#### [`list(path)`](src/fs.js#L39)
Returns array of file and directory stat objects
__Used in:__ `LIST`, `NLST`, `STAT`

#### [`chdir(path)`](src/fs.js#L56)
Returns new directory relative to current directory
#### [`chdir(path)`](src/fs.js#L56)
Returns new directory relative to current directory
__Used in:__ `CWD`, `CDUP`

#### [`mkdir(path)`](src/fs.js#L96)
Returns a path to a newly created directory
#### [`mkdir(path)`](src/fs.js#L96)
Returns a path to a newly created directory
__Used in:__ `MKD`

#### [`write(fileName, {append, start})`](src/fs.js#L68)
Returns a writable stream
Options:
`append` if true, append to existing file
`start` if set, specifies the byte offset to write to
#### [`write(fileName, {append, start})`](src/fs.js#L68)
Returns a writable stream
Options:
`append` if true, append to existing file
`start` if set, specifies the byte offset to write to
__Used in:__ `STOR`, `APPE`

#### [`read(fileName, {start})`](src/fs.js#L75)
Returns a readable stream
Options:
`start` if set, specifies the byte offset to read from
Returns a readable stream
Options:
`start` if set, specifies the byte offset to read from
__Used in:__ `RETR`

#### [`delete(path)`](src/fs.js#L87)
Delete a file or directory
Delete a file or directory
__Used in:__ `DELE`

#### [`rename(from, to)`](src/fs.js#L102)
Renames a file or directory
Renames a file or directory
__Used in:__ `RNFR`, `RNTO`

#### [`chmod(path)`](src/fs.js#L108)
Modifies a file or directory's permissions
#### [`chmod(path)`](src/fs.js#L108)
Modifies a file or directory's permissions
__Used in:__ `SITE CHMOD`

#### [`getUniqueName()`](src/fs.js#L113)
Returns a unique file name to write to
Returns a unique file name to write to
__Used in:__ `STOU`

<!--[RM_CONTRIBUTING]-->
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@
},
"engines": {
"node": ">=6.x",
"npm": ">=3.9.5"
"npm": ">=5.x"
}
}

0 comments on commit 14910ef

Please sign in to comment.