added env files for production

This commit is contained in:
Jun-te Kim 2025-05-29 14:13:27 +00:00
parent 26c7fa019b
commit 254aeb647e
7 changed files with 1394 additions and 9 deletions

0
frontend/.env Normal file
View file

View file

@ -0,0 +1 @@
DATABASE_URL=postgresql://postgres:makingwarmhomes@db:5432/postgres

1
frontend/.env.production Normal file
View file

@ -0,0 +1 @@
DATABASE_URL=postgresql://postgres:makingwarmhomes@terraform-20250331175522503500000002.cdgzupxvdyp0.eu-west-2.rds.amazonaws.com:5432/surveyDB

2
frontend/.gitignore vendored
View file

@ -31,7 +31,7 @@ yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# .env*
# vercel
.vercel

File diff suppressed because it is too large Load diff

View file

@ -9,19 +9,25 @@
"lint": "next lint"
},
"dependencies": {
"dotenv": "^16.5.0",
"drizzle-orm": "^0.44.0",
"next": "15.3.2",
"pg": "^8.16.0",
"postgres": "^3.4.7",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"next": "15.3.2"
"react-dom": "^19.0.0"
},
"devDependencies": {
"typescript": "^5",
"@eslint/eslintrc": "^3",
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/pg": "^8.15.2",
"@types/react": "^19",
"@types/react-dom": "^19",
"@tailwindcss/postcss": "^4",
"tailwindcss": "^4",
"drizzle-kit": "^0.31.1",
"eslint": "^9",
"eslint-config-next": "15.3.2",
"@eslint/eslintrc": "^3"
"tailwindcss": "^4",
"typescript": "^5"
}
}

11
frontend/src/app/db/db.ts Normal file
View file

@ -0,0 +1,11 @@
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
if (!process.env.DATABASE_URL) {
throw new Error("DATABASE_URL is not defined in environment variables");
}
const queryClient = postgres(process.env.DATABASE_URL);
const db = drizzle({ client: queryClient });
const result = await db.execute('select 1');