From 1461168af60b808280a82af0413be378e5986a70 Mon Sep 17 00:00:00 2001 From: gulimabr Date: Wed, 28 Jan 2026 15:40:47 -0300 Subject: [PATCH] improving structure --- .env.example | 2 ++ .vscode/tasks.json | 13 ------------- backend/app/main.py | 4 ++-- {data/iso => backend/data}/iso-14244-tax.json | 0 docker-compose.yml | 9 ++++----- frontend/vite.config.ts | 2 ++ 6 files changed, 10 insertions(+), 20 deletions(-) create mode 100644 .env.example delete mode 100644 .vscode/tasks.json rename {data/iso => backend/data}/iso-14244-tax.json (100%) diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e5c6fa1 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +VITE_API_BASE_URL=http://localhost:8000 +FRONTEND_ORIGIN=http://localhost:5173 \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index ddd76fb..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "noop", - "type": "shell", - "command": "echo", - "args": [ - "noop" - ] - } - ] -} \ No newline at end of file diff --git a/backend/app/main.py b/backend/app/main.py index 84acc7b..36c5338 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -82,9 +82,9 @@ def normalize_text(text: str) -> str: @lru_cache(maxsize=1) def load_taxonomy() -> dict: root_dir = Path(__file__).resolve().parents[1] - tax_path = root_dir / "data" / "iso" / "iso-14244-tax.json" + tax_path = root_dir / "data" / "iso-14244-tax.json" if not tax_path.exists(): - tax_path = Path("/data/iso/iso-14244-tax.json") + tax_path = Path("/data/iso-14244-tax.json") with tax_path.open("r", encoding="utf-8") as handle: return json.load(handle) diff --git a/data/iso/iso-14244-tax.json b/backend/data/iso-14244-tax.json similarity index 100% rename from data/iso/iso-14244-tax.json rename to backend/data/iso-14244-tax.json diff --git a/docker-compose.yml b/docker-compose.yml index 45f3479..1e99885 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,9 +5,8 @@ services: - "8000:8000" volumes: - ./backend:/app - - ./data:/app/data - environment: - - FRONTEND_ORIGIN=http://localhost:5173 + env_file: + - ./.env command: poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload frontend: @@ -17,8 +16,8 @@ services: volumes: - ./frontend:/app - /app/node_modules - environment: - - VITE_API_BASE_URL=http://localhost:8000 + env_file: + - ./.env command: pnpm dev --host 0.0.0.0 --port 5173 depends_on: - backend diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 77a11e3..3846862 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,8 +1,10 @@ import { defineConfig } from "vite"; +import path from "path"; import react from "@vitejs/plugin-react"; export default defineConfig({ plugins: [react()], + envDir: path.resolve(__dirname, ".."), server: { host: true, port: 5173,