Skip to content

Commit

Permalink
update name
Browse files Browse the repository at this point in the history
  • Loading branch information
robatipoor committed Dec 14, 2023
1 parent 441a462 commit 8b97d06
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_PROFILE=dev
RUST_BACKTRACE=1
RUST_LOG=info
DATABASE_URL=postgres://postgres_user:postgres_pass@localhost:5432/postgres_db
DATABASE_URL=postgres://username:password@localhost:5432/database_name
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUSTfulapi
# rustfulapi
Reusable template for building REST Web Services in Rust. Uses [Axum](https://github.com/tokio-rs/axum) HTTP web framework and [SeaORM](https://github.com/SeaQL/sea-orm) ORM and [PostgreSQL](https://www.postgresql.org/).

[![License](https://img.shields.io/github/license/robatipoor/rustfulapi)
Expand Down Expand Up @@ -83,6 +83,10 @@ export APP_PROFILE=prod # switch to production profile
```
cp ./scripts/git-hooks/* ./.git/hooks/
```
### Migrate database
```
cargo run --bin migration -- up -u $DATABASE_URL
```
### Update ERD (Entity-Relationship Diagram) use [planter](https://github.com/achiku/planter)
```bash
planter postgres://username:password@localhost:5432/database_name\?sslmode=disable -o docs/schema.puml
Expand Down
8 changes: 4 additions & 4 deletions docker/dev/.env
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
APP_PROFILE=dev
RUST_BACKTRACE=1
RUST_LOG=info
DATABASE_URL=postgres://postgres_user:postgres_pass@localhost:5432/postgres_db
DATABASE_URL=postgres://username:password@localhost:5432/database_name
APP_SERVER__PORT=8080
APP_SERVER__ADDR=0.0.0.0
APP_DB__USERNAME=postgres_user
APP_DB__PASSWORD=postgres_pass
APP_DB__USERNAME=username
APP_DB__PASSWORD=password
APP_DB__PORT=5432
APP_DB__HOST=postgres-db
APP_DB__DATABASE_NAME=postgres_db
APP_DB__DATABASE_NAME=database_name
APP_REDIS__USERNAME=redis_user
APP_REDIS__PASSWORD=
APP_REDIS__PORT=6379
Expand Down
8 changes: 4 additions & 4 deletions docker/prod/.env
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
APP_PROFILE=prod
RUST_BACKTRACE=1
RUST_LOG=info
DATABASE_URL=postgres://postgres_user:postgres_pass@localhost:5432/postgres_db
DATABASE_URL=postgres://username:password@localhost:5432/database_name
APP_SERVER__PORT=8080
APP_SERVER__ADDR=0.0.0.0
APP_DB__USERNAME=postgres_user
APP_DB__PASSWORD=postgres_pass
APP_DB__USERNAME=username
APP_DB__PASSWORD=password
APP_DB__PORT=5432
APP_DB__HOST=postgres-db
APP_DB__DATABASE_NAME=postgres_db
APP_DB__DATABASE_NAME=database_name
APP_REDIS__USERNAME=redis_user
APP_REDIS__PASSWORD=
APP_REDIS__PORT=6379
Expand Down
Binary file modified docs/schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/client/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async fn create_database(db: &DatabaseConnection, database_name: &str) -> AppRes
}

pub async fn setup_new_database(config: &mut AppConfig) -> AppResult<DatabaseClient> {
info!("Setup new postgres database for the test.");
info!("Setup new database for the test.");
let db = DatabaseClient::build_from_config(config).await?;
config.db.database_name =
util::random::generate_random_string_with_prefix("test_db").to_lowercase();
Expand Down
2 changes: 1 addition & 1 deletion src/handler/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::util::claim::UserClaims;
#[openapi(
info(
version = "v0.1.0",
title = "RUSTful APIs",
title = "RUSTful API",
),
paths(
// server api
Expand Down

0 comments on commit 8b97d06

Please sign in to comment.