Skip to content

Commit

Permalink
Merge pull request #196 from tinola/main
Browse files Browse the repository at this point in the history
Update ztApi.ts - change default URL of the Local Zerotier URL
  • Loading branch information
sinamics authored Nov 1, 2023
2 parents 01fa604 + 4bb3d46 commit 557389a
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://zerotier: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 557389a

Please sign in to comment.