Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ztApi.ts - change default URL of the Local Zerotier URL #196

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading