Skip to content

Commit 1598414

Browse files
fix: compare env.APP_ORIGIN parsed hostname rathern than substring match
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 4cf861c commit 1598414

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/webapp/seed.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ async function seed() {
9292

9393
// The PAT is an admin credential. Only mint and print it when seeding a local
9494
// instance, so a stray non-local `db:seed` can't leak it to stdout/logs.
95+
const localHostnames = new Set(["localhost", "127.0.0.1", "[::1]"]);
9596
const isLocalInstance =
96-
env.NODE_ENV !== "production" && /localhost|127\.0\.0\.1/.test(env.APP_ORIGIN);
97+
env.NODE_ENV !== "production" && localHostnames.has(new URL(env.APP_ORIGIN).hostname);
9798
if (isLocalInstance) {
9899
const localPat = await ensureLocalCliPat(user);
99100
console.log(`\n🔑 CLI access token for ${user.email} (name: ${localPat.name}):`);

0 commit comments

Comments
 (0)