Skip to content

Commit

Permalink
renaming curl examples to use a shorter, more accurate name: TLS_ARGS
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-johnson committed Mar 2, 2022
1 parent 6196cc7 commit 2392619
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "restapi"
description = "A secure-by-default rest api stack implemented with hyper, tokio, bb8 and postgres. This project is focused on providing end-to-end encryption by default for 12-factor applications looking to customize functionality using environment variables as needed. Includes a working user management and authentication backend written in postgresql with async S3 uploading for POST-ed data files."
version = "1.0.10"
version = "1.0.11"
edition = "2021"
license = "MIT"
authors = [
Expand Down
36 changes: 18 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
//!
//! ```bash
//! export API_TLS_DIR="./certs/tls/api"
//! export TLS_CERT_ARGS="--cacert ${API_TLS_DIR}/api-ca.pem \
//! export TLS_ARGS="--cacert ${API_TLS_DIR}/api-ca.pem \
//! --cert ${API_TLS_DIR}/api.crt \
//! --key ${API_TLS_DIR}/api.key"
//! ```
Expand All @@ -252,7 +252,7 @@
//! ### Login (user does not exist yet)
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/login" \
//! -XPOST \
//! -d '{"email":"[email protected]","password":"12345"}' | jq
Expand All @@ -261,7 +261,7 @@
//! ### Create user
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user" \
//! -XPOST \
//! -d '{"email":"[email protected]","password":"12345"}' | jq
Expand All @@ -270,7 +270,7 @@
//! ### Login and save the token as an env variable
//!
//! ```bash
//! export TOKEN=$(curl -s ${TLS_CERT_ARGS} \
//! export TOKEN=$(curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/login" \
//! -XPOST \
//! -d '{"email":"[email protected]","password":"12345"}' | jq -r '.token')
Expand All @@ -279,7 +279,7 @@
//! ### Get user
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user/1" \
//! -XGET \
//! -H "Bearer: ${TOKEN}" | jq
Expand All @@ -288,7 +288,7 @@
//! ### Update user
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user" \
//! -H "Bearer: ${TOKEN}" \
//! -XPUT \
Expand All @@ -300,7 +300,7 @@
//! #### Change to a new password
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user" \
//! -H "Bearer: ${TOKEN}" \
//! -XPUT \
Expand All @@ -310,7 +310,7 @@
//! #### Change password back to the original
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user" \
//! -H "Bearer: ${TOKEN}" \
//! -XPUT \
Expand All @@ -320,7 +320,7 @@
//! ### Create a one-time-use-password (otp) allowing a user to reset their users.password from the users.email
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user/password/reset" \
//! -H "Bearer: ${TOKEN}" \
//! -XPOST \
Expand All @@ -330,7 +330,7 @@
//! ### Consume user one-time-use-password token to reset the users.password (otp)
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user/password/change" \
//! -H "Bearer: ${TOKEN}" \
//! -XPOST \
Expand All @@ -340,7 +340,7 @@
//! ### Change user email
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user" \
//! -H "Bearer: ${TOKEN}" \
//! -XPUT \
Expand All @@ -350,14 +350,14 @@
//! ### Verify user email
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user/verify?u=1&t=2" | jq
//! ```
//!
//! ### Search user (token must be for the POST-ed user id)
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user/search" \
//! -XPOST \
//! -H "Bearer: ${TOKEN}" \
Expand All @@ -367,7 +367,7 @@
//! ### Delete user
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user" \
//! -XDELETE \
//! -d '{"email":"[email protected]","user_id":1}' \
Expand Down Expand Up @@ -442,7 +442,7 @@
//! ```
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! -XPOST \
//! --data-binary "@${UPLOAD_FILE}" \
//! "https://0.0.0.0:3000/user/data" \
Expand All @@ -458,7 +458,7 @@
//! ### Search user data (token must be for the POST-ed user id)
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user/data/search" \
//! -XPOST \
//! -H "Bearer: ${TOKEN}" \
Expand All @@ -468,7 +468,7 @@
//! ### Update a single user data record (token must be for the PUT user id)
//!
//! ```bash
//! curl -s ${TLS_CERT_ARGS} \
//! curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/user/data" \
//! -XPUT \
//! -H "Bearer: ${TOKEN}" \
Expand All @@ -478,7 +478,7 @@
//! ### Login and save the token as an env variable
//!
//! ```bash
//! export TOKEN=$(curl -s ${TLS_CERT_ARGS} \
//! export TOKEN=$(curl -s ${TLS_ARGS} \
//! "https://0.0.0.0:3000/login" \
//! -XPOST \
//! -d '{"email":"[email protected]","password":"12345"}' | jq -r '.token')
Expand Down
36 changes: 18 additions & 18 deletions tests/integration-using-curl.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```bash
export API_TLS_DIR="./certs/tls/api"
export TLS_CERT_ARGS="--cacert ${API_TLS_DIR}/api-ca.pem \
export TLS_ARGS="--cacert ${API_TLS_DIR}/api-ca.pem \
--cert ${API_TLS_DIR}/api.crt \
--key ${API_TLS_DIR}/api.key"
```
Expand All @@ -14,7 +14,7 @@ export TLS_CERT_ARGS="--cacert ${API_TLS_DIR}/api-ca.pem \
### Login (user does not exist yet)

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/login" \
-XPOST \
-d '{"email":"[email protected]","password":"12345"}' | jq
Expand All @@ -23,7 +23,7 @@ curl -s ${TLS_CERT_ARGS} \
### Create user

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user" \
-XPOST \
-d '{"email":"[email protected]","password":"12345"}' | jq
Expand All @@ -32,7 +32,7 @@ curl -s ${TLS_CERT_ARGS} \
### Login and save the token as an env variable

```bash
export TOKEN=$(curl -s ${TLS_CERT_ARGS} \
export TOKEN=$(curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/login" \
-XPOST \
-d '{"email":"[email protected]","password":"12345"}' | jq -r '.token')
Expand All @@ -41,7 +41,7 @@ export TOKEN=$(curl -s ${TLS_CERT_ARGS} \
### Get user

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user/1" \
-XGET \
-H "Bearer: ${TOKEN}" | jq
Expand All @@ -50,7 +50,7 @@ curl -s ${TLS_CERT_ARGS} \
### Update user

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user" \
-H "Bearer: ${TOKEN}" \
-XPUT \
Expand All @@ -62,7 +62,7 @@ curl -s ${TLS_CERT_ARGS} \
#### Change to a new password

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user" \
-H "Bearer: ${TOKEN}" \
-XPUT \
Expand All @@ -72,7 +72,7 @@ curl -s ${TLS_CERT_ARGS} \
#### Change password back to the original

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user" \
-H "Bearer: ${TOKEN}" \
-XPUT \
Expand All @@ -82,7 +82,7 @@ curl -s ${TLS_CERT_ARGS} \
### Create a one-time-use-password (otp) allowing a user to reset their users.password from the users.email

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user/password/reset" \
-H "Bearer: ${TOKEN}" \
-XPOST \
Expand All @@ -92,7 +92,7 @@ curl -s ${TLS_CERT_ARGS} \
### Consume user one-time-use-password token to reset the users.password (otp)

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user/password/change" \
-H "Bearer: ${TOKEN}" \
-XPOST \
Expand All @@ -102,7 +102,7 @@ curl -s ${TLS_CERT_ARGS} \
### Change user email

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user" \
-H "Bearer: ${TOKEN}" \
-XPUT \
Expand All @@ -112,14 +112,14 @@ curl -s ${TLS_CERT_ARGS} \
### Verify user email

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user/verify?u=1&t=2" | jq
```

### Search user (token must be for the POST-ed user id)

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user/search" \
-XPOST \
-H "Bearer: ${TOKEN}" \
Expand All @@ -129,7 +129,7 @@ curl -s ${TLS_CERT_ARGS} \
### Delete user

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user" \
-XDELETE \
-d '{"email":"[email protected]","user_id":1}' \
Expand Down Expand Up @@ -204,7 +204,7 @@ export S3_DATA_PREFIX="user/data/file"
```

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
-XPOST \
--data-binary "@${UPLOAD_FILE}" \
"https://0.0.0.0:3000/user/data" \
Expand All @@ -220,7 +220,7 @@ curl -s ${TLS_CERT_ARGS} \
### Search user data (token must be for the POST-ed user id)

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user/data/search" \
-XPOST \
-H "Bearer: ${TOKEN}" \
Expand All @@ -230,7 +230,7 @@ curl -s ${TLS_CERT_ARGS} \
### Update a single user data record (token must be for the PUT user id)

```bash
curl -s ${TLS_CERT_ARGS} \
curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/user/data" \
-XPUT \
-H "Bearer: ${TOKEN}" \
Expand All @@ -240,7 +240,7 @@ curl -s ${TLS_CERT_ARGS} \
### Login and save the token as an env variable

```bash
export TOKEN=$(curl -s ${TLS_CERT_ARGS} \
export TOKEN=$(curl -s ${TLS_ARGS} \
"https://0.0.0.0:3000/login" \
-XPOST \
-d '{"email":"[email protected]","password":"12345"}' | jq -r '.token')
Expand Down

0 comments on commit 2392619

Please sign in to comment.