Compare commits
4 Commits
main
...
76f7bbc9e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
76f7bbc9e2
|
|||
|
34687dda7d
|
|||
|
6c83e566bf
|
|||
|
b74c0fc3b0
|
@@ -10,3 +10,4 @@ POSTGRES_AUTH_PASSWORD=password
|
||||
POSTGRES_AUTH_DB=icarus_auth_db
|
||||
POSTGRES_AUTH_HOST=auth_db
|
||||
DATABASE_URL=postgresql://${POSTGRES_AUTH_USER}:${POSTGRES_AUTH_PASSWORD}@${POSTGRES_AUTH_HOST}:5432/${POSTGRES_AUTH_DB}
|
||||
ENABLE_REGISTRATION=TRUE
|
||||
|
||||
@@ -10,3 +10,4 @@ POSTGRES_AUTH_PASSWORD=password
|
||||
POSTGRES_AUTH_DB=icarus_auth_test_db
|
||||
POSTGRES_AUTH_HOST=localhost
|
||||
DATABASE_URL=postgresql://${POSTGRES_AUTH_USER}:${POSTGRES_AUTH_PASSWORD}@${POSTGRES_AUTH_HOST}:5432/${POSTGRES_AUTH_DB}
|
||||
ENABLE_REGISTRATION=TRUE
|
||||
12
README.md
12
README.md
@@ -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
|
||||
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
|
||||
```
|
||||
|
||||
Start images
|
||||
### Start images
|
||||
```
|
||||
docker compose up -d --force-recreate
|
||||
```
|
||||
|
||||
Bring it down
|
||||
### Bring it down
|
||||
```
|
||||
docker compose down -v
|
||||
```
|
||||
|
||||
Pruning
|
||||
### Pruning
|
||||
```
|
||||
docker system prune -a
|
||||
```
|
||||
|
||||
@@ -52,6 +52,7 @@ pub async fn register_user(
|
||||
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||
Json(payload): Json<request::Request>,
|
||||
) -> (StatusCode, Json<response::Response>) {
|
||||
if is_registration_enabled() {
|
||||
let mut user = icarus_models::user::User {
|
||||
username: payload.username.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()
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user