Spaces:
Sleeping
Sleeping
ausername-12345 commited on
Commit ·
f74f567
1
Parent(s): 683ebd7
Check HF env vars
Browse files
server.js
CHANGED
|
@@ -9,16 +9,14 @@ const PORT = process.env.PORT || 7860;
|
|
| 9 |
|
| 10 |
app.use(express.json({ limit: "1mb" }));
|
| 11 |
|
| 12 |
-
import { resolve4, resolveCname, resolveAny } from "dns/promises";
|
| 13 |
-
|
| 14 |
app.get("/api/check", async (_, res) => {
|
| 15 |
-
const
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
}
|
| 21 |
-
res.json({ ok: true,
|
| 22 |
});
|
| 23 |
|
| 24 |
app.post("/api/hf", async (req, res) => {
|
|
|
|
| 9 |
|
| 10 |
app.use(express.json({ limit: "1mb" }));
|
| 11 |
|
|
|
|
|
|
|
| 12 |
app.get("/api/check", async (_, res) => {
|
| 13 |
+
const env = {};
|
| 14 |
+
const interesting = ["HF_TOKEN", "HF_API_TOKEN", "HF_INFERENCE_ENDPOINT", "SPACE_ID", "SPACE_TITLE", "HUGGINGFACEHUB_API_TOKEN", "API_TOKEN"];
|
| 15 |
+
for (const key of interesting) {
|
| 16 |
+
if (process.env[key]) env[key] = process.env[key].length > 10 ? process.env[key].slice(0, 8) + "..." : "(set)";
|
| 17 |
+
else env[key] = "(not set)";
|
| 18 |
}
|
| 19 |
+
res.json({ ok: true, env });
|
| 20 |
});
|
| 21 |
|
| 22 |
app.post("/api/hf", async (req, res) => {
|