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,