Updated help and README.

This commit is contained in:
Jeromy Streets 2018-07-29 11:58:29 -07:00
parent 10b35029f5
commit 26bd3affa2
2 changed files with 44 additions and 5 deletions

View File

@ -25,8 +25,23 @@ TLS_CERT=
TLS_KEY=
```
### Without Docker
Matching configuration YAML settings. YAML settings are individually overridden
by the corresponding environment variable. The following is an example
configuration file with defaults. Pass in the path to the configuration file
using the command line option ('-c', '-config', '--config').
```yaml
host: ""
port: 8080
show-listing: true
folder: /web
url-prefix: ""
tls-cert: ""
tls-key: ""
```
### Without Docker
```bash
PORT=8888 FOLDER=. ./serve
```
Files can then be accessed by going to http://localhost:8888/my/file.txt
@ -34,16 +49,16 @@ Files can then be accessed by going to http://localhost:8888/my/file.txt
### With Docker
```
docker run -d -v /my/folder:/web -p 8080:8080 halverneus/static-file-server:latest
```
This will serve the folder "/my/folder" over http://localhost:9090/my/file.txt
```bash
This will serve the folder "/my/folder" over http://localhost:8080/my/file.txt
Any of the variables can also be modified:
```
```bash
docker run -d -v /home/me/dev/source:/content/html -v /home/me/dev/files:/content/more/files -e FOLDER=/content -p 8080:8080 halverneus/static-file-server:latest
```
### Also try...
```
```bash
./serve help
# OR
docker run -it halverneus/static-file-server:latest help

View File

@ -18,6 +18,7 @@ NAME
SYNOPSIS
static-file-server
static-file-server [ -c | -config | --config ] /path/to/config.yml
static-file-server [ help | -help | --help ]
static-file-server [ version | -version | --version ]
@ -59,6 +60,24 @@ ENVIRONMENT VARIABLES
start with a forward-slash and NOT end with a forward-slash. If not
supplied then no prefix is used.
CONFIGURATION FILE
Configuration can also managed used a YAML configuration file. To select the
configuration values using the YAML file, pass in the path to the file using
the appropriate flags (-c, --config). Environment variables take priority
over the configuration file. The following is an example configuration using
the default values.
Example config.yml with defaults:
----------------------------------------------------------------------------
folder: /web
host: ""
port: 8080
show-listing: true
tls-cert: ""
tls-key: ""
url-prefix: ""
----------------------------------------------------------------------------
USAGE
FILE LAYOUT
/var/www/sub/my.file
@ -75,6 +94,11 @@ USAGE
export PORT=80
static-file-server
Retrieve with: wget http://my.machine/sub/my.file
export FOLDER=/var/www
static-file-server -c config.yml
Result: Runs with values from config.yml, but with the folder being
served overridden by the FOLDER environment variable.
export FOLDER=/var/www/sub
export HOST=my.machine