-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from demarches-simplifiees/various_cleaning
Various cleaning
- Loading branch information
Showing
18 changed files
with
1,338 additions
and
832 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /bin/bash | ||
PASSWORD='a good password' | ||
SALT='12345678901234567890123456789012' | ||
KEYRING_FILE=/tmp/keyring.toml | ||
|
||
DS_PROXY_LOG=/tmp/ds_proxy_log | ||
NODE_LOG=/tmp/node_log | ||
|
||
echo 'compiling ds_proxy' | ||
cargo build | ||
|
||
echo 'building simple node server which mimics a backend storage' | ||
npm install --prefix tests/fixtures/server-static | ||
|
||
echo 'building keyring file' | ||
./target/debug/ds_proxy add-key --password-file <(echo -n "$PASSWORD") --keyring-file "$KEYRING_FILE" --salt "$SALT" | ||
|
||
echo 'launching ds_proxy listenning on 4444' | ||
RUST_LOG=info ./target/debug/ds_proxy proxy --address "127.0.0.1:4444" --password-file <(echo -n "$PASSWORD") --salt "$SALT" --keyring-file "$KEYRING_FILE" --upstream-url "http://localhost:3333" > "$DS_PROXY_LOG" 2>&1 & | ||
|
||
echo 'launching fake backend storage with node listenning on 3333' | ||
DEBUG=express:* node tests/fixtures/server-static/server.js > "$NODE_LOG" 2>&1 & | ||
|
||
cat << EOF | ||
ds_proxy is now running, and a basic node js server mimics a backend storage. | ||
their logs are $DS_PROXY_LOG and $NODE_LOG | ||
you can add a clear file in the fake storage, and fetch it | ||
curl -X PUT localhost:3333/clear --data-binary @<(echo -n 'I am clear') | ||
cat tests/fixtures/server-static/uploads/clear | ||
curl localhost:3333/clear | ||
you can encrypt a file by using the ds_proxy, fetch it | ||
curl -X PUT localhost:4444/upstream/cyphered --data-binary @<(echo -n 'What a secret') | ||
curl localhost:4444/upstream/cyphered | ||
you can even try to decrypt the cyphered version by hand | ||
cat tests/fixtures/server-static/uploads/cyphered | ||
curl localhost:3333/cyphered | ||
EOF | ||
|
||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.