mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-13 05:06:25 +00:00
♻️ make fossorial remote API only configurable on the frontend and only in DEV
This commit is contained in:
@@ -51,8 +51,14 @@ export const internal = axios.create({
|
||||
}
|
||||
});
|
||||
|
||||
const remoteAPIURL =
|
||||
process.env.NODE_ENV === "development"
|
||||
? (process.env.NEXT_PUBLIC_FOSSORIAL_REMOTE_API_URL ??
|
||||
"https://api.fossorial.io")
|
||||
: "https://api.fossorial.io";
|
||||
|
||||
export const remote = axios.create({
|
||||
baseURL: `${process.env.NEXT_PUBLIC_FOSSORIAL_REMOTE_API_URL}/api/v1`,
|
||||
baseURL: `${remoteAPIURL}/api/v1`,
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
||||
@@ -21,11 +21,6 @@ const envSchema = z.object({
|
||||
.transform((val) => val === "true"),
|
||||
APP_VERSION: z.string(),
|
||||
DASHBOARD_URL: z.string(),
|
||||
NEXT_PUBLIC_FOSSORIAL_REMOTE_API_URL: z
|
||||
.string()
|
||||
.url()
|
||||
.default("https://api.fossorial.io")
|
||||
.transform((url) => url.replace(/(.*)\/?$/, "$1")),
|
||||
|
||||
// Email configuration
|
||||
EMAIL_ENABLED: z
|
||||
@@ -117,8 +112,7 @@ export function pullEnv(): Env {
|
||||
environment: env.ENVIRONMENT,
|
||||
sandbox_mode: env.SANDBOX_MODE,
|
||||
version: env.APP_VERSION,
|
||||
dashboardUrl: env.DASHBOARD_URL,
|
||||
fossorialRemoteAPIBaseUrl: env.NEXT_PUBLIC_FOSSORIAL_REMOTE_API_URL
|
||||
dashboardUrl: env.DASHBOARD_URL
|
||||
},
|
||||
email: {
|
||||
emailEnabled: env.EMAIL_ENABLED
|
||||
|
||||
@@ -4,7 +4,6 @@ export type Env = {
|
||||
sandbox_mode: boolean;
|
||||
version: string;
|
||||
dashboardUrl: string;
|
||||
fossorialRemoteAPIBaseUrl: string;
|
||||
};
|
||||
server: {
|
||||
externalPort: string;
|
||||
|
||||
Reference in New Issue
Block a user