mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-28 13:48:13 +02:00
pull port from env var
This commit is contained in:
parent
50d374d9f6
commit
be144fe15d
2 changed files with 11 additions and 17 deletions
|
@ -1,20 +1,21 @@
|
|||
import axios from "axios";
|
||||
|
||||
// let origin;
|
||||
// if (typeof window !== "undefined") {
|
||||
// origin = window.location.origin;
|
||||
// }
|
||||
let origin;
|
||||
if (typeof window !== "undefined") {
|
||||
origin = window.location.origin;
|
||||
}
|
||||
|
||||
export const api = axios.create({
|
||||
baseURL: `http://localhost:3000/api/v1`,
|
||||
baseURL: `${origin}/api/v1`,
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
// we can pull from env var here becuase it is only used in the server
|
||||
export const internal = axios.create({
|
||||
baseURL: `http://localhost:3000/api/v1`,
|
||||
baseURL: `http://localhost:${process.env.SERVER_EXTERNAL_PORT}/api/v1`,
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue