This commit is contained in:
2026-03-19 16:36:41 +07:00
parent 1999395f3c
commit 7eddfb28b0
5 changed files with 14 additions and 4 deletions

View File

@@ -4,6 +4,6 @@ DATABASE_URL=postgresql://postgres:postgres@localhost:5432/app_admin
SESSION_SECRET=change-me SESSION_SECRET=change-me
SESSION_NAME=pgcc.sid SESSION_NAME=pgcc.sid
ALLOWED_ORIGIN=http://localhost:5173 ALLOWED_ORIGIN=http://localhost:5173
POSTGRES_CONTAINER_NAME=pg-control-postgres POSTGRES_CONTA INER_NAME=pg-control-postgres
COOKIE_SECURE=false COOKIE_SECURE=false

View File

@@ -49,7 +49,7 @@ services:
context: ./frontend context: ./frontend
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
VITE_API_BASE_URL: http://localhost:4000/api VITE_API_BASE_URL: /api
container_name: pg-control-frontend container_name: pg-control-frontend
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:

View File

@@ -5,6 +5,15 @@ server {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html; index index.html;
location /api/ {
proxy_pass http://backend:4000/api/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }

View File

@@ -1,4 +1,4 @@
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || "http://localhost:4000/api"; const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || "/api";
async function request(path, options = {}) { async function request(path, options = {}) {
const response = await fetch(`${API_BASE_URL}${path}`, { const response = await fetch(`${API_BASE_URL}${path}`, {

View File

@@ -43,10 +43,11 @@ create table if not exists table_group_tables (
); );
create table if not exists role_permissions ( create table if not exists role_permissions (
id uuid primary key default gen_random_uuid(),
role_id uuid not null references roles(id) on delete cascade, role_id uuid not null references roles(id) on delete cascade,
permission_id uuid not null references permissions(id) on delete cascade, permission_id uuid not null references permissions(id) on delete cascade,
table_group_id uuid references table_groups(id) on delete cascade, table_group_id uuid references table_groups(id) on delete cascade,
primary key(role_id, permission_id, table_group_id) unique nulls not distinct (role_id, permission_id, table_group_id)
); );
create table if not exists audit_logs ( create table if not exists audit_logs (