Compare commits

..

No commits in common. "04eb33df6e70efff83aee30cabf85afa9c8c1064" and "a2a8d945c6d45ee39029db965a732732ffcb1e97" have entirely different histories.

10 changed files with 26 additions and 19 deletions

View file

@ -1,5 +1,5 @@
# Build stage # Build stage
FROM node:22-alpine AS builder FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
@ -10,7 +10,7 @@ RUN npm run build
# Production stage — only the self-contained .output is needed. # Production stage — only the self-contained .output is needed.
# bash + curl are added so Dokploy scheduled tasks (which wrap commands in # bash + curl are added so Dokploy scheduled tasks (which wrap commands in
# `bash -c "..."`) can run; alpine ships only ash and has no curl by default. # `bash -c "..."`) can run; alpine ships only ash and has no curl by default.
FROM node:22-alpine FROM node:20-alpine
RUN apk add --no-cache bash curl RUN apk add --no-cache bash curl
WORKDIR /app WORKDIR /app
COPY --from=builder /app/.output .output COPY --from=builder /app/.output .output

View file

@ -91,7 +91,8 @@ export default defineNuxtConfig({
}, },
runtimeConfig: { runtimeConfig: {
// Private keys (server-side only) // Private keys (server-side only)
mongodbUri: process.env.MONGODB_URI || "", mongodbUri:
process.env.MONGODB_URI || "mongodb://localhost:27017/ghostguild",
jwtSecret: process.env.JWT_SECRET || "", jwtSecret: process.env.JWT_SECRET || "",
resendApiKey: process.env.RESEND_API_KEY || "", resendApiKey: process.env.RESEND_API_KEY || "",
helcimApiToken: process.env.HELCIM_API_TOKEN || "", helcimApiToken: process.env.HELCIM_API_TOKEN || "",

View file

@ -4,7 +4,7 @@ import { Resend } from 'resend'
import Member from '../../../models/member.js' import Member from '../../../models/member.js'
import { connectDB } from '../../../utils/mongoose.js' import { connectDB } from '../../../utils/mongoose.js'
const resend = new Resend(useRuntimeConfig().resendApiKey) const resend = new Resend(process.env.RESEND_API_KEY)
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
await requireAdmin(event) await requireAdmin(event)

View file

@ -4,7 +4,7 @@ import { Resend } from 'resend'
import PreRegistration from '../../../models/preRegistration.js' import PreRegistration from '../../../models/preRegistration.js'
import { connectDB } from '../../../utils/mongoose.js' import { connectDB } from '../../../utils/mongoose.js'
const resend = new Resend(useRuntimeConfig().resendApiKey) const resend = new Resend(process.env.RESEND_API_KEY)
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
await requireAdmin(event) await requireAdmin(event)

View file

@ -1,17 +1,23 @@
export default defineNitroPlugin(() => { export default defineNitroPlugin(() => {
const config = useRuntimeConfig() const required = [
const checks = { 'MONGODB_URI',
MONGODB_URI: config.mongodbUri, 'JWT_SECRET',
JWT_SECRET: config.jwtSecret, 'RESEND_API_KEY',
RESEND_API_KEY: config.resendApiKey, 'HELCIM_API_TOKEN',
HELCIM_API_TOKEN: config.helcimApiToken, ]
}
const missing = Object.entries(checks).filter(([, value]) => !value).map(([key]) => key) const missing = required.filter((key) => {
// Check both process.env and runtime config where applicable
if (key === 'JWT_SECRET') {
const config = useRuntimeConfig()
return !config.jwtSecret
}
return !process.env[key]
})
if (missing.length > 0) { if (missing.length > 0) {
console.error(`FATAL: Missing required environment variables: ${missing.join(', ')}`) console.error(`FATAL: Missing required environment variables: ${missing.join(', ')}`)
console.error('Set these (or their NUXT_-prefixed equivalents) in your .env file or environment variables.') console.error('Set these in your .env file or environment variables.')
process.exit(1) process.exit(1)
} }
}) })

View file

@ -12,7 +12,7 @@ import { Resend } from "resend";
import Member from "../../../models/member.js"; import Member from "../../../models/member.js";
import { connectDB } from "../../../utils/mongoose.js"; import { connectDB } from "../../../utils/mongoose.js";
const resend = new Resend(useRuntimeConfig().resendApiKey); const resend = new Resend(process.env.RESEND_API_KEY);
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
await connectDB(); await connectDB();

View file

@ -6,7 +6,7 @@ import { randomUUID } from 'crypto'
import { Resend } from 'resend' import { Resend } from 'resend'
import Member from '../models/member.js' import Member from '../models/member.js'
const resend = new Resend(useRuntimeConfig().resendApiKey) const resend = new Resend(process.env.RESEND_API_KEY)
/** /**
* Issue a 15-minute magic-link JWT for `email` and email it. * Issue a 15-minute magic-link JWT for `email` and email it.

View file

@ -7,7 +7,7 @@ export const connectDB = async () => {
return; return;
} }
const MONGODB_URI = useRuntimeConfig().mongodbUri; const MONGODB_URI = process.env.NUXT_MONGODB_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/ghostguild';
try { try {
await mongoose.connect(MONGODB_URI, { await mongoose.connect(MONGODB_URI, {

View file

@ -2,7 +2,7 @@ import { Resend } from 'resend'
import Payment from '../models/payment.js' import Payment from '../models/payment.js'
import { paymentConfirmationEmail } from '../emails/paymentConfirmation.js' import { paymentConfirmationEmail } from '../emails/paymentConfirmation.js'
const resend = new Resend(useRuntimeConfig().resendApiKey) const resend = new Resend(process.env.RESEND_API_KEY)
function mapStatus(helcimStatus) { function mapStatus(helcimStatus) {
if (helcimStatus === 'paid') return 'success' if (helcimStatus === 'paid') return 'success'

View file

@ -1,6 +1,6 @@
import { Resend } from "resend"; import { Resend } from "resend";
const resend = new Resend(useRuntimeConfig().resendApiKey); const resend = new Resend(process.env.RESEND_API_KEY);
/** /**
* Send event registration confirmation email * Send event registration confirmation email