From 234d34c6a1ad7919f3c395671586bae442a45e30 Mon Sep 17 00:00:00 2001 From: Stanislav Khoshov Date: Sat, 6 Sep 2025 19:51:31 +0300 Subject: [PATCH] add api host secret --- .github/workflows/deploy_dev.yml | 2 ++ frontend/.env.production | 2 ++ frontend/src/lib/api.ts | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 frontend/.env.production diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index d62167d..bdf0ee5 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -26,6 +26,8 @@ jobs: - name: Build frontend working-directory: frontend + env: + VITE_API_BASE_URL: ${{ secrets.DEV_API_BASE_URL }} run: npm run build - name: Deploy diff --git a/frontend/.env.production b/frontend/.env.production new file mode 100644 index 0000000..442bcad --- /dev/null +++ b/frontend/.env.production @@ -0,0 +1,2 @@ +# API Base URL for production +VITE_API_BASE_URL=https://your-domain.com/api/v1 \ No newline at end of file diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 7777cc9..dce70fa 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -1,7 +1,7 @@ import axios from 'axios'; import type { Book, Publisher, Tag, PaginatedResponse } from '@/types'; -const API_BASE_URL = 'http://localhost:8001/api/v1'; +const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8001/api/v1'; const api = axios.create({ baseURL: API_BASE_URL,