Skip to content

Commit

Permalink
Tweak readme and example config file.
Browse files Browse the repository at this point in the history
  • Loading branch information
de-vri-es committed Sep 30, 2023
1 parent dbe3cb9 commit fbb8f49
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 27 deletions.
67 changes: 61 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,8 @@ When the feature is enabled, `openssl` is linked statically against a locally co
This can be used to create a binary with a minimal set of runtime dependencies,
and it can make compilation easier on systems with no recent version of OpenSSL readily available.

On windows, this has been reported to work.
```
choco install openssl
set OPENSSL_DIR=C:\Program Files\OpenSSL-Win64
```
For more information on how to build with a locally installed version of OpenSSL see:
https://docs.rs/openssl/latest/openssl/#building

## Examples
The `multipart-stdin` example shows how to process `multipart/form-data` from stdin and how to pass additional environment variables to your hooks from the config file.
Expand All @@ -84,13 +81,16 @@ Build the example
cargo build --example multipart-stdin --features static-openssl
```

Add the hook (windows example)
```
Add the hook:
```yaml:
- url: "/multipart-stdin"
commands:
- cmd: ["cmd.exe","/c","target\\debug\\examples\\multipart-stdin.exe"]
- cmd: [""target/debug/examples/multipart-stdin"]
stdin: request-body
environment: ["OUTPUT_FOLDER=uploads","COUNT_SUFFIX","APPLY_TIMESTAMP"]
environment:
OUTPUT_FOLDER: uploads
COUNT_SUFFIX: 1
APPLY_TIMESTAMP: 1
```
Run the server:
Expand Down
20 changes: 8 additions & 12 deletions example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ log-level: info

# The TLS section is optional.
# If it is present, the server will only accept HTTPS requests.
#tls:
# private-key: /etc/letsencrypt/live/example.com/privkey.pem
# certificate-chain: /etc/letsencrypt/live/example.com/fullchain.pem
# tls:
# private-key: /etc/letsencrypt/live/example.com/privkey.pem
# certificate-chain: /etc/letsencrypt/live/example.com/fullchain.pem

# The hooks.
hooks:
Expand All @@ -23,23 +23,19 @@ hooks:
commands:
- cmd: ["env"]

- url: "/print-env-win32"
commands:
- cmd: ["cmd.exe","/c","set"]

# A hook that prints the current working directory, useful for debugging.
# Output is sent to the server log, not as HTTP response body.
- url: "/print-cwd"
commands:
- cmd: ["pwd"]

- url: "/print-cwd-win32"
commands:
- cmd: ["cmd.exe","/c","cd"]

# A hook that handles file uploads from a multipart/form-data request.
# You need to run `cargo build --examples` for this hook to work.
- url: "/multipart-stdin"
commands:
- cmd: ["target/debug/examples/multipart-stdin"]
stdin: request-body
environment:
environment:
OUTPUT_FOLDER: uploads
COUNT_SUFFIX: 1
APPLY_TIMESTAMP: 1
Expand Down

0 comments on commit fbb8f49

Please sign in to comment.