diff --git a/frontend/index.html b/frontend/index.html index 7afc70c..b1ebdaf 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -5,6 +5,8 @@ Dating App + +
diff --git a/frontend/public/env.js b/frontend/public/env.js new file mode 100644 index 0000000..7bc8e0a --- /dev/null +++ b/frontend/public/env.js @@ -0,0 +1,3 @@ +window.__ENV__ = { + API_BASE: "http://localhost:8000" +}; diff --git a/frontend/public/env.js.template b/frontend/public/env.js.template new file mode 100644 index 0000000..d289065 --- /dev/null +++ b/frontend/public/env.js.template @@ -0,0 +1,3 @@ +window.__ENV__ = { + API_BASE: "${API_BASE:-http://localhost:8000}" +}; diff --git a/frontend/src/api.js b/frontend/src/api.js index 08ac0c1..a821b82 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -1,7 +1,7 @@ import axios from 'axios' -// Get API base URL from environment or default -const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000' +// Get API base URL from runtime environment (window.__ENV__) or build-time env +const API_BASE_URL = window.__ENV__?.API_BASE || import.meta.env.VITE_API_URL || 'http://localhost:8000' // Create axios instance with default config const api = axios.create({