diff --git a/backend/utils/controller-api.js b/backend/utils/controller-api.js index 8bdbfe3..028a081 100644 --- a/backend/utils/controller-api.js +++ b/backend/utils/controller-api.js @@ -1,13 +1,16 @@ import axios from "axios"; import fs from "node:fs"; +import os from "node:os"; const baseURL = process.env.ZU_CONTROLLER_ENDPOINT || "http://localhost:9993/"; var token; if (process.env.ZU_CONTROLLER_TOKEN) { token = process.env.ZU_CONTROLLER_TOKEN; -} else { +} else if (os.platform() === "linux") { token = fs.readFileSync("/var/lib/zerotier-one/authtoken.secret", "utf8"); +} else { + throw new Error("Please provide ZU_CONTROLLER_TOKEN in environment"); } export const api = axios.create({