diff --git a/.gitignore b/.gitignore index ccc9ca9d..0b817e64 100755 --- a/.gitignore +++ b/.gitignore @@ -197,7 +197,6 @@ celerybeat.pid # Environments .env -.env.development .venv env/ venv/ diff --git a/README.md b/README.md index 698f1933..e45c8cd3 100755 --- a/README.md +++ b/README.md @@ -12,8 +12,7 @@ Guccho is a web interface to interact with osu private servers with compatibilit ## Setup - Config .env *important* -for production, create .env from .env.example. -for development please create both .env and .env.development. `build` will use `.env` as environments to ensure you don't made any secrets to the public. +create .env from .env.example. - Run `yarn` - Run `yarn build:hljs` diff --git a/package.json b/package.json index c879c8bd..c58fc9a1 100755 --- a/package.json +++ b/package.json @@ -8,10 +8,10 @@ "build:hljs": "node scripts/gen-hljs.mjs", "build:gen": "yarn build:schemas & yarn build:hljs", "build:all": "yarn build:gen && yarn build", - "dev": "nuxi --dotenv .env.development dev", + "dev": "nuxi dev", "generate": "nuxi generate", "start:prod": "dotenv -e .env node .output/server/index.mjs", - "start:dev:inspect": "dotenv -e .env.development node -- --inspect .output/server/index.mjs", + "start:dev:inspect": "dotenv -e .env node -- --inspect .output/server/index.mjs", "analyze": "nuxi analyze", "postinstall": "nuxi prepare", "typecheck": "nuxi typecheck", diff --git a/src/server/env/index.ts b/src/server/env/index.ts index c5fd7fac..c8cf9c27 100644 --- a/src/server/env/index.ts +++ b/src/server/env/index.ts @@ -2,6 +2,9 @@ import type { ZodType, z } from 'zod' import { ZodError, literal, object, string, union } from 'zod' import { fromZodError } from 'zod-validation-error' import { zodFQDN, zodPath } from '~/server/trpc/shapes' +import { Logger } from '$base/log' + +const logger = Logger.child({ label: 'env' }) export const database = literal('database') export const memory = literal('memory') @@ -65,18 +68,21 @@ export function ensureAndGetEnv(zod: Z): z.infer { } catch (e) { if (!(e instanceof ZodError)) { + logger.error(e) throw e } + const formattedZodError = fromZodError( + e, + { + prefix: 'env validation error:\n', + prefixSeparator: '', + issueSeparator: ';\n', + unionSeparator: ',\n', + } + ) + logger.error(formattedZodError) throw new Error( - fromZodError( - e, - { - prefix: 'env validation error:\n', - prefixSeparator: '', - issueSeparator: ';\n', - unionSeparator: ',\n', - } - ).message + formattedZodError.message ) } } diff --git a/src/server/trpc/routers/me.ts b/src/server/trpc/routers/me.ts index 2057589d..ad18d277 100644 --- a/src/server/trpc/routers/me.ts +++ b/src/server/trpc/routers/me.ts @@ -216,7 +216,7 @@ export const router = _router({ if (err.message === 'has-relationship') { throw new TRPCError({ code: 'CONFLICT', - message: 'need to delete old relation before create new', + message: 'you have existing relations, delete old one first.', }) } }