Skip to content

Commit

Permalink
zt url
Browse files Browse the repository at this point in the history
  • Loading branch information
sinamics committed Nov 2, 2023
1 parent 3dd03d1 commit 3d3d0c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/pages/admin/controller/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ const Controller = () => {
{
name: "localControllerUrl",
type: "text",
placeholder: me?.options?.localControllerUrl || "http://zerotier:9993",
placeholder:
me?.options?.localControllerUrlPlaceholder || "http://zerotier:9993",
value: me?.options?.localControllerUrl,
},
]}
Expand Down
17 changes: 8 additions & 9 deletions src/server/api/routers/authRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,16 @@ export const authRouter = createTRPCRouter({
options: true,
},
})) as User & {
options?: UserOptions & { urlFromEnv?: boolean; secretFromEnv?: boolean };
options?: UserOptions & {
urlFromEnv?: boolean;
secretFromEnv?: boolean;
localControllerUrlPlaceholder?: string;
};
};

// Set URL from environment or use existing setting
if (process.env.ZT_ADDR) {
user.options.localControllerUrl = process.env.ZT_ADDR;
} else if (!user.options.localControllerUrl) {
user.options.localControllerUrl = isRunningInDocker()
? "http://zerotier:9993"
: "http://127.0.0.1:9993";
}
user.options.localControllerUrlPlaceholder = isRunningInDocker()
? "http://zerotier:9993"
: "http://127.0.0.1:9993";

// Set secret environment status
user.options.urlFromEnv = !!process.env.ZT_ADDR;
Expand Down

0 comments on commit 3d3d0c5

Please sign in to comment.