Skip to content

Commit 7e76ef9

Browse files
committed
hotfix: client domain env
oopsie non so leggere
1 parent 007e3be commit 7e76ef9

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

src/components/create-url-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function CreateUrlDialog({
112112
<p className="text-xs">Preview: </p>
113113
<div className="text-sm p-4 border rounded-md border-border mb-4 mt-1 flex flex-col gap-1 bg-muted/50 text-muted-foreground">
114114
<p className="font-mono mx-auto">
115-
https://${env.DOMAIN}/
115+
https://${env.NEXT_PUBLIC_DOMAIN}/
116116
{isRandom ? (
117117
<RandomText generate={randomCode} />
118118
) : (

src/components/dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export function Dashboard() {
121121
<div className="flex items-center gap-4">
122122
<Image src={logo} alt="PoliNetwork Logo" className="h-16 w-16" />
123123
<div className="gap-2">
124-
<h1 className="text-3xl font-bold">${env.DOMAIN}</h1>
124+
<h1 className="text-3xl font-bold">{env.NEXT_PUBLIC_DOMAIN}</h1>
125125
<p className="text-muted-foreground max-md:text-sm">
126126
PoliNetwork's URL shortener dashboard
127127
</p>

src/env.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@ import { z } from "zod"
33

44
const PORT = 6111
55

6+
const domainSchema = z
7+
.string()
8+
.default(`polinet.cc`)
9+
.describe(
10+
"This is the domain to use as shortener. API available at /api and Admin dashboard at /admin"
11+
)
12+
613
// coerce is needed for non-string values, because k8s supports only string env
714
export const env = createEnv({
15+
client: {
16+
NEXT_PUBLIC_DOMAIN: domainSchema,
17+
},
818
server: {
919
PORT: z.coerce.number().min(1).max(65535).default(PORT),
1020
NODE_ENV: z.enum(["development", "production"]).default("development"),
1121
// PUBLIC_URL: z.string().default(`https://polinet.cc`),
1222
// LOG_LEVEL: z.string().default("DEBUG"),
13-
DOMAIN: z
14-
.string()
15-
.default(`polinet.cc`)
16-
.describe(
17-
"This is the domain to use as shortener. API available at /api and Admin dashboard at /admin"
18-
),
19-
23+
DOMAIN: domainSchema,
2024
DB_HOST: z.string().min(1),
2125
DB_PORT: z.coerce.number().min(1).max(65535).default(5432),
2226
DB_USER: z.string().min(1),
@@ -28,6 +32,7 @@ export const env = createEnv({
2832
runtimeEnv: {
2933
PORT: process.env.PORT,
3034
DOMAIN: process.env.DOMAIN,
35+
NEXT_PUBLIC_DOMAIN: process.env.DOMAIN,
3136
DB_HOST: process.env.DB_HOST,
3237
DB_PORT: process.env.DB_PORT,
3338
DB_USER: process.env.DB_USER,

src/lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ export const copyToClipboard = async (text: string) => {
3737
}
3838

3939
export function makeShortUrl(url: UrlRecord): string {
40-
return `https://${env.DOMAIN}/${url.short_code}`
40+
return `https://${env.NEXT_PUBLIC_DOMAIN}/${url.short_code}`
4141
}

0 commit comments

Comments
 (0)