mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-02-25 16:05:22 +08:00
20 lines
445 B
JavaScript
20 lines
445 B
JavaScript
|
const axios = require("axios");
|
||
|
const fs = require("fs");
|
||
|
|
||
|
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 {
|
||
|
token = fs.readFileSync("/var/lib/zerotier-one/authtoken.secret", "utf8");
|
||
|
}
|
||
|
|
||
|
module.exports = axios.create({
|
||
|
baseURL: baseURL,
|
||
|
responseType: "json",
|
||
|
headers: {
|
||
|
"X-ZT1-Auth": token,
|
||
|
},
|
||
|
});
|