-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCargo.toml
85 lines (78 loc) · 2.97 KB
/
Cargo.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
[package]
name = "zero2prod"
version = "0.1.0"
edition = "2021"
[package.metadata.commands]
# Check whether database is down and restart if so, needed for tests and general app function
database = "./scripts/start_database.sh"
# Before running tests, restart the database if down
test = "cargo cmd database && cargo nextest run --failure-output final"
# Clean Postgres from temporary databases that are made by test runs
clean = "./scripts/clean_database.sh newsletter"
# Build app for production. `--target-dir` needed as otherwise the app is not being built in the `target` directory
build = "cargo build --release --target-dir ../target"
# Run app after restarting database
run = "cargo cmd database && cargo run | bunyan"
# Run productionized app after restarting database
run-prod = "cargo cmd database && ./target/release/zero2prod | bunyan"
# Run tests, clean temporary databases, run the app
dev = "cargo watch -x 'cmd test' -x 'cmd clean' -x 'cmd run'"
# Run tests, clean temporary databases, run the productionized app
prod = "cargo watch -x 'cmd test' -x 'cmd clean' -x 'cmd build && cargo cmd run-prod'"
# Run tests, clean temporary databases, build Docker containers
docker-build = "cargo watch -x 'cmd test' -x 'cmd clean' -s './scripts/build.sh'"
# Run tests, clean temporary databases, build Docker containers, run the app in Docker
docker-dev = "cargo watch -x 'cmd test' -x 'cmd clean' -s './scripts/run.sh'"
# Run tests, clean temporary databases, build Docker containers, run the productionized app in Docker
docker-prod = "cargo watch -x 'cmd test' -x 'cmd clean' -s './scripts/run.sh release'"
[lib]
path = "src/lib.rs"
[[bin]]
name = "zero2prod"
path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = "4"
chrono = { version = "0", default-features = false, features = ["clock"] }
claim = "0"
config = "0"
log = "0.4"
once_cell = "1"
reqwest = { version = "0", default-features = false, features = [
"json",
"rustls-tls",
] }
scopeguard = "1"
secrecy = { version = "0", features = ["serde"] }
sendgrid = { version = "0", default-features = false, features = [
"rustls",
"async",
] }
serde = { version = "1", features = ["derive"] }
sqlx = { version = "0", default-features = false, features = [
"runtime-tokio-rustls",
"macros",
"postgres",
"uuid",
"chrono",
"migrate",
"offline",
] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1", features = ["log"] }
tracing-actix-web = "0.7"
tracing-bunyan-formatter = "0.3"
tracing-log = "0.1"
tracing-subscriber = { version = "0.3", features = ["registry", "env-filter"] }
unicode-segmentation = "1"
uuid = { version = "1", features = ["v4"] }
validator = "0"
rand = { version = "0.8", features = ["std_rng"] }
[dev-dependencies]
# https://github.com/LukeMathWalker/zero-to-production/issues/34
fake = "2"
quickcheck = "1"
quickcheck_macros = "1"
serde_json = "1"
wiremock = "0"
linkify = "0"