Compare commits

...

4 Commits

Author SHA1 Message Date
76f7bbc9e2 tsk-61: Updating readme 2025-10-20 12:16:43 -04:00
34687dda7d tsk-61: Adding changes to make feature available 2025-10-20 12:16:31 -04:00
6c83e566bf tsk-61: Filename change 2025-10-20 12:12:19 -04:00
b74c0fc3b0 tsk-61: Added env variable 2025-10-20 12:11:52 -04:00
4 changed files with 72 additions and 59 deletions

View File

@@ -10,3 +10,4 @@ POSTGRES_AUTH_PASSWORD=password
POSTGRES_AUTH_DB=icarus_auth_db POSTGRES_AUTH_DB=icarus_auth_db
POSTGRES_AUTH_HOST=auth_db POSTGRES_AUTH_HOST=auth_db
DATABASE_URL=postgresql://${POSTGRES_AUTH_USER}:${POSTGRES_AUTH_PASSWORD}@${POSTGRES_AUTH_HOST}:5432/${POSTGRES_AUTH_DB} DATABASE_URL=postgresql://${POSTGRES_AUTH_USER}:${POSTGRES_AUTH_PASSWORD}@${POSTGRES_AUTH_HOST}:5432/${POSTGRES_AUTH_DB}
ENABLE_REGISTRATION=TRUE

View File

@@ -10,3 +10,4 @@ POSTGRES_AUTH_PASSWORD=password
POSTGRES_AUTH_DB=icarus_auth_test_db POSTGRES_AUTH_DB=icarus_auth_test_db
POSTGRES_AUTH_HOST=localhost POSTGRES_AUTH_HOST=localhost
DATABASE_URL=postgresql://${POSTGRES_AUTH_USER}:${POSTGRES_AUTH_PASSWORD}@${POSTGRES_AUTH_HOST}:5432/${POSTGRES_AUTH_DB} DATABASE_URL=postgresql://${POSTGRES_AUTH_USER}:${POSTGRES_AUTH_PASSWORD}@${POSTGRES_AUTH_HOST}:5432/${POSTGRES_AUTH_DB}
ENABLE_REGISTRATION=TRUE

View File

@@ -8,22 +8,26 @@ need to be modified. The `SECRET_KEY` variable should be changed since it will b
generation. The `SECRET_PASSPHASE` should also be changed when in production mode, but make sure generation. The `SECRET_PASSPHASE` should also be changed when in production mode, but make sure
the respective `passphrase` database table record exists. the respective `passphrase` database table record exists.
Build image To enable or disable registrations, use `TRUE` or `FALSE` for the `ENABLE_REGISTRATION` variable.
By default it is `TRUE`.
### Build image
``` ```
docker compose build docker compose build
``` ```
Start images ### Start images
``` ```
docker compose up -d --force-recreate docker compose up -d --force-recreate
``` ```
Bring it down ### Bring it down
``` ```
docker compose down -v docker compose down -v
``` ```
Pruning ### Pruning
``` ```
docker system prune -a docker system prune -a
``` ```

View File

@@ -52,6 +52,7 @@ pub async fn register_user(
axum::Extension(pool): axum::Extension<sqlx::PgPool>, axum::Extension(pool): axum::Extension<sqlx::PgPool>,
Json(payload): Json<request::Request>, Json(payload): Json<request::Request>,
) -> (StatusCode, Json<response::Response>) { ) -> (StatusCode, Json<response::Response>) {
if is_registration_enabled() {
let mut user = icarus_models::user::User { let mut user = icarus_models::user::User {
username: payload.username.clone(), username: payload.username.clone(),
password: payload.password.clone(), password: payload.password.clone(),
@@ -115,4 +116,10 @@ pub async fn register_user(
}), }),
), ),
} }
} else {
(axum::http::StatusCode::NOT_ACCEPTABLE, Json(response::Response{
message: String::from("Registration is not enabled"),
data:: Vec::new()
}))
}
} }