mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-08-19 21:03:56 -07:00
feat: add support to default authtoken location of major platforms
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
parent
17bf258ea1
commit
9e0b691cf7
1 changed files with 15 additions and 1 deletions
|
@ -7,7 +7,21 @@ var token;
|
||||||
if (process.env.ZU_CONTROLLER_TOKEN) {
|
if (process.env.ZU_CONTROLLER_TOKEN) {
|
||||||
token = process.env.ZU_CONTROLLER_TOKEN;
|
token = process.env.ZU_CONTROLLER_TOKEN;
|
||||||
} else {
|
} else {
|
||||||
|
if (process.platform === "unix") {
|
||||||
token = fs.readFileSync("/var/lib/zerotier-one/authtoken.secret", "utf8");
|
token = fs.readFileSync("/var/lib/zerotier-one/authtoken.secret", "utf8");
|
||||||
|
} else if (process.platform === "win32") {
|
||||||
|
token = fs.readFileSync(
|
||||||
|
"C:\\ProgramData\\ZeroTier\\One\\authtoken.secret",
|
||||||
|
"utf8"
|
||||||
|
);
|
||||||
|
} else if (process.platform === "darwin") {
|
||||||
|
token = fs.readFileSync(
|
||||||
|
"/Library/Application Support/ZeroTier/One/authtoken.secret",
|
||||||
|
"utf8"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw `Unsupported platform ${process.platform}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = axios.create({
|
module.exports = axios.create({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue