Updated axios request object, added minio

This commit is contained in:
Benjamin Sherriff
2023-10-19 16:55:13 -04:00
parent 55b8b1a0e3
commit f46748167c
9 changed files with 65 additions and 18 deletions

View File

@@ -17,6 +17,12 @@ REFRESH_TOKEN_MAXAGE=30
REDIS_HOST=localhost
REDIS_PORT=6379
MINIO_ROOT_USER=siren
MINIO_ROOT_PASSWORD=
MINIO_HOST=localhost
MINIO_PORT=9000
MINIO_PORT_INTERNAL=9001
SERVICE_HOST=localhost
SERVICE_PORT=5000
DATA_DIR_PATH=

View File

@@ -28,6 +28,7 @@ argon2 = "0.5.2"
jsonwebtoken = "9.0.0"
redis = { version = "0.23.3", features = ["tokio-comp", "connection-manager", "r2d2"] }
base64 = "0.21.4"
rust-s3 = "0.33.0"
[dependencies.tokio]
version = "1.32.0"

View File

@@ -16,6 +16,7 @@ build: ## Build the docker image
utils: ## Start the utils
docker compose up -d db
docker compose up -d redis
docker compose up -d minio
up: ## Start the app
docker compose up -d

View File

@@ -1,5 +1,8 @@
version: '3.8'
x-env_file_personifi: &env
- .env
name: siren
services:
service:
@@ -10,13 +13,14 @@ services:
dockerfile: ./Dockerfile
args:
- VERSION=${SIREN_VERSION:-latest}
env_file:
- .env
env_file: *env
environment:
DATABASE_HOST: db
DATABASE_PORT: 5432
REDIS_HOST: redis
REDIS_PORT: 6379
MINIO_HOST: minio
MINIO_PORT: 9000
SERVICE_HOST: service
SERVICE_PORT: 5000
DATA_DIR_PATH: /data
@@ -33,8 +37,7 @@ services:
db:
image: postgres:latest
container_name: siren-db
env_file:
- .env
env_file: *env
environment:
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
@@ -55,10 +58,26 @@ services:
networks:
- backend
restart: unless-stopped
minio:
image: minio/minio
container_name: siren-minio
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
volumes:
- minio:/data
ports:
- ${MINIO_PORT:-9000}:9000
- ${MINIO_PORT_INTERNAL:-9001}:9001
networks:
- backend
command: server --console-address ":9001" /data
restart: unless-stopped
volumes:
db:
db_logs:
minio:
networks:
frontend:

View File

@@ -98,11 +98,13 @@ async fn login(request: web::Json<LoginRequest>) -> HttpResponse {
.path("/")
.max_age(Duration::new(access_token_max_age * 60, 0))
.http_only(true)
.secure(true)
.finish();
let refresh_cookie = Cookie::build("refresh_token", refresh_token_details.token.clone().unwrap())
.path("/")
.max_age(Duration::new(refresh_token_max_age * 60, 0))
.http_only(true)
.secure(true)
.finish();
let logged_in_cookie = Cookie::build("logged_in", "true")
.path("/")
@@ -210,6 +212,7 @@ async fn refresh(req: HttpRequest) -> HttpResponse {
.path("/")
.max_age(Duration::new(access_token_max_age * 60, 0))
.http_only(true)
.secure(true)
.finish();
let logged_in_cookie = Cookie::build("logged_in", "true")
.path("/")
@@ -254,6 +257,7 @@ async fn refresh(req: HttpRequest) -> HttpResponse {
.path("/")
.max_age(Duration::new(refresh_token_max_age * 60, 0))
.http_only(true)
.secure(true)
.finish();
HttpResponse::Ok()