-
Notifications
You must be signed in to change notification settings - Fork 71
fisrt_commit #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fisrt_commit #176
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,38 @@ | ||
| # REDIS_URL=redis://redis:6379 | ||
| # REDIS_URL=redis://localhost:6379 | ||
| # DATABASE_URL=postgresql://volunchain:volunchain123@db:5432/volunchain | ||
| DATABASE_URL=postgresql://volunchain:volunchain123@localhost:5434/volunchain | ||
| # Core Environment Variables | ||
| NODE_ENV=development | ||
| PORT=3000 | ||
| JWT_SECRET=your-jwt-secret | ||
| JWT_SECRET=Zq0gGppr1PIqJsYbCJptI+xmgVvd3BViQUEw2nvsiBs= | ||
| DB_TYPE=postgres | ||
| # DB_HOST=db | ||
| # DB_PORT=5432 | ||
| DB_HOST=localhost | ||
| DB_PORT=5434 | ||
|
|
||
| # DIRECT_URL=DATABASE_URL=postgresql://user:password@localhost:5432/volunchain?schema=public&connection_limit=10&pool_timeout=30&idle_timeout=30 | ||
| DIRECT_URL=postgresql://volunchain:volunchain123@localhost:5434/volunchain | ||
| DATABASE_CONNECTION_LIMIT=10 | ||
| DATABASE_POOL_TIMEOUT=30 | ||
| DATABASE_IDLE_TIMEOUT=30 | ||
| DATABASE_CONNECTION_TIMEOUT=10 | ||
| ENABLE_QUERY_LOGGING=true | ||
| QUERY_TIMEOUT=30000 | ||
|
|
||
|
|
||
| DB_USER=volunchain | ||
| DB_PASSWORD=volunchain123 | ||
| DB_NAME=volunchain | ||
| NODE_ENV="development" | ||
| BACKBLAZE_APPLICATION_KEY_ID= | ||
| BACKBLAZE_APPLICATION_KEY= | ||
| BACKBLAZE_BUCKET_ID= | ||
|
|
||
| RATE_LIMIT_MAX_REQUESTS=100 | ||
| RATE_LIMIT_WINDOW_MINUTES=5 | ||
| # Database | ||
| DATABASE_URL=postgresql://user:password@localhost:5432/volunchain | ||
|
|
||
| RATE_LIMIT_AUTH_MAX=10 | ||
| RATE_LIMIT_AUTH_WINDOW=3 | ||
| # JWT / Security | ||
| JWT_SECRET=your_jwt_secret | ||
|
|
||
| RATE_LIMIT_WALLET_MAX=50 | ||
| RATE_LIMIT_WALLET_WINDOW=5 | ||
| # Supabase | ||
| SUPABASE_URL=https://your-supabase-url.supabase.co | ||
| SUPABASE_ANON_KEY=your_supabase_anon_key | ||
|
|
||
| RATE_LIMIT_EMAIL_MAX=20 | ||
| RATE_LIMIT_EMAIL_WINDOW=5 | ||
| # Redis | ||
| REDIS_URL=redis://localhost:6379 | ||
|
|
||
| RATE_LIMIT_DEFAULT_MAX=100 | ||
| RATE_LIMIT_DEFAULT_WINDOW=5 | ||
| # Stellar / Horizon | ||
| HORIZON_URL=https://horizon-testnet.stellar.org | ||
| STELLAR_NETWORK=testnet | ||
|
|
||
| AWS_ACCESS_KEY_ID=your-access-key-here | ||
| AWS_SECRET_ACCESS_KEY=your-secret-access-key | ||
| AWS_REGION=eu-north-1 | ||
| S3_BUCKET_NAME=volunchain-certificates-test | ||
| SOROBAN_RPC_URL=your_rpc_url | ||
| SOROBAN_SERVER_SECRET=your_server_secret | ||
| EMAIL_SERVICE=gmail | ||
| [email protected] | ||
| EMAIL_PASSWORD=your_email_password | ||
| BASE_URL=http://localhost:3000 | ||
|
|
||
| # Supabase | ||
| SUPABASE_URL=https://your-project.supabase.co | ||
| SUPABASE_ANON_KEY=your-anon-key | ||
| # Soroban | ||
| SOROBAN_RPC_URL=https://soroban-testnet.stellar.org | ||
| SOROBAN_SERVER_SECRET=your_soroban_server_secret | ||
|
|
||
| # Rate Limiting | ||
| RATE_LIMIT_WINDOW_MS=900000 | ||
| RATE_LIMIT_MAX_REQUESTS=100 | ||
| RATE_LIMIT_MESSAGE=Too many requests, please try again later. | ||
|
|
||
| # Email Verification | ||
| EMAIL_SECRET=your_email_verification_secret |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { get } from "env-var"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Use 'get' directly instead of 'env.get' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const env = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NODE_ENV: get("NODE_ENV").default("development").asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PORT: get("PORT").default("3000").asPortNumber(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DATABASE_URL: get("DATABASE_URL").required().asUrlString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // JWT / Security | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| JWT_SECRET: get("JWT_SECRET").required().asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Supabase | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SUPABASE_URL: get("SUPABASE_URL").required().asUrlString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SUPABASE_ANON_KEY: get("SUPABASE_ANON_KEY").required().asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Redis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| REDIS_URL: get("REDIS_URL").default("redis://localhost:6379").asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Stellar / Horizon | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HORIZON_URL: get("HORIZON_URL").default("https://horizon-testnet.stellar.org").asUrlString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| STELLAR_NETWORK: get("STELLAR_NETWORK").default("testnet").asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EMAIL_SERVICE: get("EMAIL_SERVICE").default("gmail").asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EMAIL_USER: get("EMAIL_USER").required().asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EMAIL_PASSWORD: get("EMAIL_PASSWORD").required().asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BASE_URL: get("BASE_URL").default("http://localhost:3000").asUrlString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Soroban | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SOROBAN_RPC_URL: get("SOROBAN_RPC_URL").required().asUrlString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SOROBAN_SERVER_SECRET: get("SOROBAN_SERVER_SECRET").required().asString(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Verification agent π§© Analysis chainMake env-loading self-contained and tighten validation (enums/URL).
If STELLAR_NETWORK accepts "public" instead of "mainnet" anywhere, adjust enum accordingly. Verify: Patch: +import "dotenv/config";
import { get } from "env-var";
-// Use 'get' directly instead of 'env.get'
-export const env = {
- NODE_ENV: get("NODE_ENV").default("development").asString(),
+// Use 'get' directly instead of 'env.get'
+export const env = Object.freeze({
+ NODE_ENV: get("NODE_ENV").default("development").asEnum(["development", "test", "production"]),
PORT: get("PORT").default("3000").asPortNumber(),
// Database
DATABASE_URL: get("DATABASE_URL").required().asUrlString(),
// JWT / Security
JWT_SECRET: get("JWT_SECRET").required().asString(),
// Supabase
SUPABASE_URL: get("SUPABASE_URL").required().asUrlString(),
SUPABASE_ANON_KEY: get("SUPABASE_ANON_KEY").required().asString(),
// Redis
- REDIS_URL: get("REDIS_URL").default("redis://localhost:6379").asString(),
+ REDIS_URL: get("REDIS_URL").default("redis://localhost:6379").asUrlString(),
// Stellar / Horizon
HORIZON_URL: get("HORIZON_URL").default("https://horizon-testnet.stellar.org").asUrlString(),
- STELLAR_NETWORK: get("STELLAR_NETWORK").default("testnet").asString(),
+ STELLAR_NETWORK: get("STELLAR_NETWORK").default("testnet").asEnum(["testnet", "mainnet"]),
@@
SOROBAN_RPC_URL: get("SOROBAN_RPC_URL").required().asUrlString(),
SOROBAN_SERVER_SECRET: get("SOROBAN_SERVER_SECRET").required().asString(),
-};
+} as const);π Script executed: #!/bin/bash
rg -nP -C2 --type=ts "STELLAR_NETWORK|['\"](public|mainnet)['\"]"Length of output: 1691 Load dotenv and tighten env validation
+import "dotenv/config";
import { get } from "env-var";
-export const env = {
+export const env = Object.freeze({
+ NODE_ENV: get("NODE_ENV").default("development").asEnum(["development", "test", "production"]),
PORT: get("PORT").default("3000").asPortNumber(),
// Database
DATABASE_URL: get("DATABASE_URL").required().asUrlString(),
// JWT / Security
JWT_SECRET: get("JWT_SECRET").required().asString(),
// Supabase
SUPABASE_URL: get("SUPABASE_URL").required().asUrlString(),
SUPABASE_ANON_KEY: get("SUPABASE_ANON_KEY").required().asString(),
// Redis
- REDIS_URL: get("REDIS_URL").default("redis://localhost:6379").asString(),
+ REDIS_URL: get("REDIS_URL").default("redis://localhost:6379").asUrlString(),
// Stellar / Horizon
HORIZON_URL: get("HORIZON_URL").default("https://horizon-testnet.stellar.org").asUrlString(),
- STELLAR_NETWORK: get("STELLAR_NETWORK").default("testnet").asString(),
+ STELLAR_NETWORK: get("STELLAR_NETWORK").default("testnet").asEnum(["testnet", "mainnet"]),
// Email
EMAIL_SERVICE: get("EMAIL_SERVICE").default("gmail").asString(),
EMAIL_USER: get("EMAIL_USER").required().asString(),
EMAIL_PASSWORD: get("EMAIL_PASSWORD").required().asString(),
BASE_URL: get("BASE_URL").default("http://localhost:3000").asUrlString(),
// Soroban
SOROBAN_RPC_URL: get("SOROBAN_RPC_URL").required().asUrlString(),
SOROBAN_SERVER_SECRET: get("SOROBAN_SERVER_SECRET").required().asString(),
-};
+} as const);π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| import dotenv from "dotenv"; | ||
| import { env } from "./env"; | ||
|
|
||
| dotenv.config(); | ||
|
Comment on lines
1
to
4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: dotenv loads after env import due to ESM import order env.ts evaluates before dotenv.config() here, so .env values wonβt be visible to env. Move dotenv loading into env.ts and remove it here. -import dotenv from "dotenv";
-import { env } from "./env";
-
-dotenv.config();
+import { env } from "./env";Then in src/config/env.ts (outside this hunk), ensure: import "dotenv/config"; // load .env before reading variablesπ€ Prompt for AI Agents |
||
|
|
||
| export const horizonConfig = { | ||
| url: process.env.HORIZON_URL || "https://horizon-testnet.stellar.org", | ||
| network: process.env.STELLAR_NETWORK || "testnet", | ||
| url: env.HORIZON_URL || "https://horizon-testnet.stellar.org", | ||
| network: env.STELLAR_NETWORK || "testnet", | ||
| timeout: 30000, // 30 seconds timeout for API calls | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| import dotenv from "dotenv"; | ||
| import { env } from "./env"; | ||
|
|
||
| dotenv.config(); | ||
|
Comment on lines
1
to
4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Verification agent π§© Analysis chaindotenv.config() runs after env import β order-of-operations bug
Apply this diff here: -import dotenv from "dotenv";
-import { env } from "./env";
-
-dotenv.config();
+import { env } from "./env";And at the very top of import dotenv from "dotenv";
dotenv.config();Verify no stray initializations remain: π Script executed: #!/bin/bash
rg -nP -C2 'dotenv\.config\s*\(' srcLength of output: 1730 Centralize dotenv initialization in src/config/env.ts and remove all other calls
|
||
|
|
||
| export const sorobanConfig = { | ||
| rpcUrl: process.env.SOROBAN_RPC_URL || "https://soroban-testnet.stellar.org", | ||
| serverSecret: process.env.SOROBAN_SERVER_SECRET, | ||
| rpcUrl: env.SOROBAN_RPC_URL || "https://soroban-testnet.stellar.org", | ||
| serverSecret: env.SOROBAN_SERVER_SECRET, | ||
| }; | ||
|
|
||
| // Validate required environment variables | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import { createClient } from '@supabase/supabase-js'; | ||
| import { env } from "./env"; | ||
|
|
||
| const supabaseUrl = process.env.SUPABASE_URL!; | ||
| const supabaseKey = process.env.SUPABASE_ANON_KEY!; | ||
| const supabaseUrl = env.SUPABASE_URL!; | ||
| const supabaseKey = env.SUPABASE_ANON_KEY!; | ||
|
|
||
| export const supabase = createClient(supabaseUrl, supabaseKey); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import winston from "winston"; | ||
| import path from "path"; | ||
| import { env } from "./env"; | ||
|
|
||
| const { combine, timestamp, errors, json, printf } = winston.format; | ||
|
|
||
|
|
@@ -17,8 +18,8 @@ const consoleFormat = printf( | |
| const logsDir = path.join(process.cwd(), "logs"); | ||
|
|
||
| const createLogger = () => { | ||
| const isProduction = process.env.NODE_ENV === "production"; | ||
| const isDevelopment = process.env.NODE_ENV === "development"; | ||
| const isProduction = env.NODE_ENV === "production"; | ||
| const isDevelopment = env.NODE_ENV === "development"; | ||
|
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Unify config source and add LOG_LEVEL to env module Now that NODE_ENV is read from env, LOG_LEVEL should be too for consistency and testability. Apply within this file: - const isProduction = env.NODE_ENV === "production";
- const isDevelopment = env.NODE_ENV === "development";
+ const isProduction = env.NODE_ENV === "production";
+ const isDevelopment = env.NODE_ENV === "development";
@@
- level: process.env.LOG_LEVEL || (isProduction ? "info" : "debug"),
+ level: env.LOG_LEVEL || (isProduction ? "info" : "debug"),And in src/config/env.ts (outside this hunk), add: import "dotenv/config"; // ensure .env is loaded once, early
export const env = {
// ...
LOG_LEVEL: get("LOG_LEVEL").default("info").asEnum(["error","warn","info","http","verbose","debug","silly"]),
};Also applies to: 74-75 |
||
|
|
||
| const transports: winston.transport[] = []; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document all required envs: missing SOROBAN_RPC_URL in failures list.
env.ts marks SOROBAN_RPC_URL as required; add it to keep docs aligned with runtime validation.
Apply:
**Common startup failure messages:** - `DATABASE_URL environment variable is required` - `JWT_SECRET environment variable is required` - `SUPABASE_URL environment variable is required` - `SUPABASE_ANON_KEY environment variable is required` - `EMAIL_USER environment variable is required` - `EMAIL_PASSWORD environment variable is required` +- `SOROBAN_RPC_URL environment variable is required` - `SOROBAN_SERVER_SECRET environment variable is required`π Committable suggestion
π€ Prompt for AI Agents