Skip to content

Commit

Permalink
chapter 10 part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
josemoura212 committed Jun 29, 2024
1 parent 6c82298 commit c0ff165
Show file tree
Hide file tree
Showing 21 changed files with 461 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ jobs:
- name: Migrate database
run: SKIP_DOCKER=true ./scripts/init_db.sh
- name: Generate code coverage
run: cargo tarpaulin --verbose --workspace
run: cargo tarpaulin --verbose --workspace

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

203 changes: 203 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ path = "src/main.rs"
name = "zero2prod"

[dependencies]
actix-session = { version = "0.9.0", features = ["redis-rs-tls-session"] }
actix-web = "4.5.1"
actix-web-flash-messages = { version = "0.4.2", features = ["cookies"] }
anyhow = "1.0.86"
Expand All @@ -24,6 +25,7 @@ rand = { version = "0.8.5", features = ["std_rng"] }
secrecy = { version = "0.8.0", features = ["serde"] }
serde = { version = "1.0.203", features = ["derive"] }
serde-aux = "4.5.0"
serde_json = "1.0.117"
thiserror = "1.0.61"
tokio = {version = "1.37.0",features = ["macros", "rt-multi-thread"]}
tracing = { version = "0.1.40", features = ["log"] }
Expand All @@ -33,7 +35,7 @@ tracing-log = "0.2.0"
tracing-subscriber = { version = "0.3.18", features = ["registry", "env-filter"] }
unicode-segmentation = "1.11.0"
urlencoding = "2.1.3"
uuid = { version = "1.8.0", features = ["v4"] }
uuid = { version = "1.8.0", features = ["v4","serde"] }
validator = "0.14.0"

[dependencies.reqwest]
Expand Down
1 change: 1 addition & 0 deletions configuration/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ email_client:
sender_email: "test@gmail.com"
authorization_token: "my-token-postmark"
timeout_milliseconds: 10000
redis_uri: "redis://127.0.0.1:6379"
7 changes: 7 additions & 0 deletions migrations/20240629172111_seed_user.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Add migration script here
INSERT INTO users (user_id, username, password_hash)
VALUES (
'ddf8994f-d522-4659-8d02-c1d479057be6',
'admin',
'$argon2id$v=19$m=15000,t=2,p=1$mqGVHMcXDj7NdEzoJa7LbA$thYUazMi8NbUrPfUYh66l7H37zxLQdI5HiXxLNBLPw0'
);
15 changes: 15 additions & 0 deletions scripts/init_redis.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$RUNNING_CONTAINER = (docker ps --filter 'name=redis' --format '{{.ID}}')
if ($RUNNING_CONTAINER) {
Write-Host "There is a redis container already running, kill it with"
Write-Host "docker kill $RUNNING_CONTAINER"
exit 1
}

# Launch Redis using Docker
docker run `
-p "6379:6379" `
-d `
--name "redis_zero2prod" `
redis:6

Write-Host "Redis is ready to go!"
Loading

0 comments on commit c0ff165

Please sign in to comment.