Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[staff] Remove .env.local and rename the env var to match main photos apps

Manav Rathif5a90abbaf36
diff --git a/infra/staff/.env b/infra/staff/.env
new file mode 100644
index 0000000000..e5d8beabbe
--- /dev/null
+++ b/infra/staff/.env
@@ -0,0 +1,9 @@
+# This is a sample .env file. The env vars defined here can be used to configure
+# the app.
+#
+# For local development, create a new file named `.env.local` and add the
+# variables you need there instead of uncommenting them below.
+#
+# For documentation about the variables, see `src/vite-env.d.ts`.
+
+# VITE_ENTE_API_ORIGIN = http://localhost:8080
diff --git a/infra/staff/.env.local b/infra/staff/.env.local
deleted file mode 100644
index 3151dc2a84..0000000000
--- a/infra/staff/.env.local
+++ /dev/null
@@ -1 +0,0 @@
-VITE_ENTE_ENDPOINT = http://localhost:8080
diff --git a/infra/staff/src/App.tsx b/infra/staff/src/App.tsx
index e9e38636bd..93a9cd5ae0 100644
--- a/infra/staff/src/App.tsx
+++ b/infra/staff/src/App.tsx
@@ -1,10 +1,8 @@
import React, { useEffect, useState } from "react";
+import { apiOrigin } from "./services/support";
import S from "./utils/strings";
export const App: React.FC = () => {
- const [serverUrl /*, setServerUrl */] = useState(
- import.meta.env.VITE_ENTE_ENDPOINT || "",
- );
const [token, setToken] = useState("");
const [email, setEmail] = useState("");
const [userData, setUserData] = useState<any>(null);
@@ -15,7 +13,6 @@ export const App: React.FC = () => {
if (storedToken) {
setToken(storedToken);
}
- console.log(import.meta.env.VITE_ENTE_ENDPOINT);
}, []);
useEffect(() => {
@@ -28,7 +25,7 @@ export const App: React.FC = () => {
const fetchData = async () => {
try {
- const url = `${serverUrl}/admin/user?email=${email}&token=${token}`;
+ const url = `${apiOrigin}/admin/user?email=${email}&token=${token}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error("Network response was not ok");
diff --git a/infra/staff/src/services/support-service.ts b/infra/staff/src/services/support.ts
similarity index 87%
rename from infra/staff/src/services/support-service.ts
rename to infra/staff/src/services/support.ts
index 3e22234e76..a4e0d93e84 100644
--- a/infra/staff/src/services/support-service.ts
+++ b/infra/staff/src/services/support.ts
@@ -1,6 +1,6 @@
import { z } from "zod";
-const apiOrigin = import.meta.env.VITE_ENTE_ENDPOINT ?? "https://api.ente.io";
+export const apiOrigin = import.meta.env.VITE_ENTE_API_ORIGIN ?? "https://api.ente.io";
const UserDetails = z.object({}).passthrough();
diff --git a/infra/staff/src/vite-env.d.ts b/infra/staff/src/vite-env.d.ts
index b49bd06d07..185a374417 100644
--- a/infra/staff/src/vite-env.d.ts
+++ b/infra/staff/src/vite-env.d.ts
@@ -8,9 +8,9 @@ interface ImportMetaEnv {
/**
* Override the origin (scheme://host:port) of Ente's API to connect to.
*
- * This is useful when testing or connecting to alternative installations.
+ * Default is "https://api.ente.io".
*/
- readonly VITE_ENTE_ENDPOINT: string | undefined;
+ readonly VITE_ENTE_API_ORIGIN: string | undefined;
}
interface ImportMeta {