Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions apps/backend/src/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ const AppDataSource = new DataSource({
password: process.env.NX_DB_PASSWORD,
database: process.env.NX_DB_DATABASE,
entities: [User, Donation, Goal, EmailTemplate, EmailSubscriber],
migrations: [],
// Setting synchronize: true shouldn't be used in production - otherwise you can lose production data
synchronize: true,
// Removed PluralNamingStrategy - use explicit @Entity('table_name') instead
migrations: ['apps/backend/src/migrations/*.ts'],
synchronize: false,
ssl: process.env.NX_DB_SSL === 'true' ? { rejectUnauthorized: false } : false,
});

export default AppDataSource;
6 changes: 5 additions & 1 deletion apps/backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule, {
rawBody: true,
});
const origins = (process.env.CORS_ORIGINS ?? 'http://localhost:4200')
.split(',')
.map((s) => s.trim())
.filter(Boolean);
app.enableCors({
origin: 'http://localhost:4200',
origin: origins,
credentials: true,
});

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ services:
NX_AWS_ACCESS_KEY: ${NX_AWS_ACCESS_KEY}
NX_AWS_SECRET_ACCESS_KEY: ${NX_AWS_SECRET_ACCESS_KEY}

STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY}

VITE_API_BASE_URL: http://localhost:3000

ports:
Expand Down
4 changes: 4 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# ------------------------------------------------------------------------------
VITE_API_BASE_URL=

# Comma-separated list of allowed CORS origins (defaults to http://localhost:4200 when unset).
# In prod set to e.g. https://your-wp-site.com,https://your-amplify-domain.amplifyapp.com
CORS_ORIGINS=

# DATABASE
NX_DB_HOST=localhost
NX_DB_USERNAME=postgres
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"class-validator": "^0.14.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"dotenv": "^16.4.5",
"global": "^4.4.0",
"jwks-rsa": "^3.1.0",
"lucide-react": "^0.563.0",
Expand Down
Loading