Skip to content

Commit 9d6ec2d

Browse files
fix: use NEXT_PUBLIC prefix for DOMAIN env
Since we use it both on client and server, we must do this. An alternative is to compute strings on server side and pass it through API to the client, but that's too overcomplicated for a public available information such as the domain we use
1 parent 3704f97 commit 9d6ec2d

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/env.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,16 @@ export const env = createEnv({
88
client: {
99
NEXT_PUBLIC_DOMAIN: z
1010
.string()
11-
.describe("Exposed to client side, same as env.DOMAIN"),
11+
.default(`polinet.cc`)
12+
.describe(
13+
"This is the domain to use as shortener. API available at /api and Admin dashboard at /admin"
14+
),
1215
},
1316
server: {
1417
PORT: z.coerce.number().min(1).max(65535).default(PORT),
1518
NODE_ENV: z.enum(["development", "production"]).default("development"),
1619
// PUBLIC_URL: z.string().default(`https://polinet.cc`),
1720
// LOG_LEVEL: z.string().default("DEBUG"),
18-
DOMAIN: z
19-
.string()
20-
.default(`polinet.cc`)
21-
.describe(
22-
"This is the domain to use as shortener. API available at /api and Admin dashboard at /admin"
23-
),
24-
2521
DB_HOST: z.string().min(1),
2622
DB_PORT: z.coerce.number().min(1).max(65535).default(5432),
2723
DB_USER: z.string().min(1),
@@ -32,8 +28,7 @@ export const env = createEnv({
3228

3329
runtimeEnv: {
3430
PORT: process.env.PORT,
35-
DOMAIN: process.env.DOMAIN,
36-
NEXT_PUBLIC_DOMAIN: process.env.DOMAIN,
31+
NEXT_PUBLIC_DOMAIN: process.env.NEXT_PUBLIC_DOMAIN,
3732
DB_HOST: process.env.DB_HOST,
3833
DB_PORT: process.env.DB_PORT,
3934
DB_USER: process.env.DB_USER,

0 commit comments

Comments
 (0)