Compare commits

...

6 Commits
main ... public

Author SHA1 Message Date
metatroncubeswdev
7816b4d2be Merge main: add the real public quick-audit endpoint for crawlerx.co
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 19:19:21 -04:00
metatroncubeswdev
bed11be657 Merge main: replace the actual logo asset (crawlerx-mark.png was MetatronCube's cube) 2026-10-18 21:05:14 -04:00
metatroncubeswdev
368c82ee4e Merge main: finish CrawlerX rebrand (theme tokens, sign-in page, logo refs) 2026-10-18 17:56:48 -04:00
metatroncubeswdev
20361f3451 Merge main: branding fix, Autumn local-ledger guards, JSON 404 fix 2026-10-18 01:37:00 -04:00
metatroncubeswdev
4f52d02df1 vite.config.ts: use loadEnv() instead of bare process.env
process.env inside defineConfig() only sees whatever the OS process
environment already has — it does not automatically contain a project's
.env file contents just because Vite loads that file elsewhere (envPrefix
only reaches import.meta.env in app code, a separate mechanism). The
previous commit's PORT/ALLOWED_HOST read from process.env worked only by
coincidence of how a process happened to be launched, and silently did
nothing when it wasn't. loadEnv() is Vite's own documented API for reading
.env files inside the config itself, independent of the launch method.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-17 20:09:51 -04:00
metatroncubeswdev
bed0504418 vite.config.ts: actually read PORT/ALLOWED_HOST from env
Both were documented self-host knobs (SELF_HOSTING_DOCKER.md, compose.yaml)
but hardcoded to port 3001 and seo.thedomainnest.com instead, so any second
instance on a different port/domain got either a port clash or Vite's
preview host-check ("Blocked request... not allowed"). Defaults preserve
exact current behavior for deployments that don't set these.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-17 19:55:16 -04:00

View File

@ -1,5 +1,5 @@
import { tanstackStart } from "@tanstack/react-start/plugin/vite"; import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import { defineConfig } from "vite"; import { defineConfig, loadEnv } from "vite";
import tsConfigPaths from "vite-tsconfig-paths"; import tsConfigPaths from "vite-tsconfig-paths";
import viteReact from "@vitejs/plugin-react"; import viteReact from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite"; import tailwindcss from "@tailwindcss/vite";
@ -7,14 +7,28 @@ import { cloudflare } from "@cloudflare/vite-plugin";
import { devtools } from "@tanstack/devtools-vite"; import { devtools } from "@tanstack/devtools-vite";
import { leanWorkerBundle } from "./vite-plugin-lean-worker-bundle"; import { leanWorkerBundle } from "./vite-plugin-lean-worker-bundle";
export default defineConfig(() => { export default defineConfig(({ mode }) => {
const port = 3001; // PORT/ALLOWED_HOST are documented self-host knobs (SELF_HOSTING_DOCKER.md,
// compose.yaml) but were never actually read here — every deployment was
// silently stuck on port 3001 and this one hardcoded domain, breaking any
// second instance on a different domain or port. Defaults keep existing
// deployments that don't set these working exactly as before.
//
// Read via Vite's own loadEnv(), not bare process.env: process.env inside
// this config function only sees whatever the OS process environment
// already has (e.g. exported by the shell or pm2's ecosystem file) —
// Vite's .env-file loading (envPrefix below) only reaches import.meta.env
// in app code, not this function. loadEnv reads the same .env files Vite
// always has, regardless of how the process was launched.
const env = loadEnv(mode, process.cwd(), "");
const port = Number(env.PORT) || 3001;
const showDevtools = false; const showDevtools = false;
const allowedHosts = [ const allowedHosts = [
"seo.thedomainnest.com", "seo.thedomainnest.com",
]; env.ALLOWED_HOST,
].filter((host): host is string => Boolean(host));
return { return {
envPrefix: [ envPrefix: [