Skip to content

Commit

Permalink
Update ztApi.ts
Browse files Browse the repository at this point in the history
When not docker enviroment use http://127.0.0.1:9993 else http://zerotier:9993
  • Loading branch information
tinola authored Nov 1, 2023
1 parent 6f564b2 commit 4bb3d46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils/ztApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { type NetworkAndMemberResponse } from "~/types/network";
import { UserContext } from "~/types/ctx";
import os from "os";
import { prisma } from "~/server/db";
import { isRunningInDocker } from "./docker";

export let ZT_FOLDER: string;
export let ZT_FILE: string;
Expand All @@ -38,7 +39,11 @@ if (os.platform() === "freebsd") {
ZT_FILE = process.env.ZT_SECRET_FILE || `${ZT_FOLDER}/authtoken.secret`;
}

const LOCAL_ZT_ADDR = process.env.ZT_ADDR || "http://127.0.0.1:9993";
const LOCAL_ZT_ADDR =
process.env.ZT_ADDR || isRunningInDocker()
? "http://zerotier:9993"
: "http://127.0.0.1:9993";

const CENTRAL_ZT_ADDR = "https://api.zerotier.com/api/v1";

let ZT_SECRET = process.env.ZT_SECRET;
Expand Down

0 comments on commit 4bb3d46

Please sign in to comment.