Skip to content

Commit

Permalink
fix: correctly manage client and server env
Browse files Browse the repository at this point in the history
  • Loading branch information
Keeqler committed Aug 29, 2024
1 parent a87f93d commit 905d30a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ BTCPAY_PRIVACY_GUIDES_WEBHOOK_SECRET=""
BTCPAY_GENERAL_STORE_ID=""
BTCPAY_GENERAL_WEBHOOK_SECRET=""

NEXT_PUBLIC_MONERO_APPLICATION_RECIPIENT=""
NEXT_PUBLIC_FIRO_APPLICATION_RECIPIENT=""
NEXT_PUBLIC_PRIVACY_GUIDES_APPLICATION_RECIPIENT=""
NEXT_PUBLIC_GENERAL_APPLICATION_RECIPIENT=""
MONERO_APPLICATION_RECIPIENT=""
FIRO_APPLICATION_RECIPIENT=""
PRIVACY_GUIDES_APPLICATION_RECIPIENT=""
GENERAL_APPLICATION_RECIPIENT=""
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
APP_URL: https://donate.magicgrants.org
DATABASE_URL: ${DATABASE_URL}

NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_URL: https://donate.magicgrants.org
NEXTAUTH_URL_INTERNAL: http://localhost:3000
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}

Expand Down Expand Up @@ -64,6 +64,11 @@ services:
BTCPAY_GENERAL_STORE_ID: ${BTCPAY_GENERAL_STORE_ID}
BTCPAY_GENERAL_WEBHOOK_SECRET: ${BTCPAY_GENERAL_WEBHOOK_SECRET}

MONERO_APPLICATION_RECIPIENT: [email protected]
FIRO_APPLICATION_RECIPIENT: [email protected]
PRIVACY_GUIDES_APPLICATION_RECIPIENT: [email protected]
GENERAL_APPLICATION_RECIPIENT: [email protected]

NEXT_PUBLIC_MONERO_APPLICATION_RECIPIENT: [email protected]
NEXT_PUBLIC_FIRO_APPLICATION_RECIPIENT: [email protected]
NEXT_PUBLIC_PRIVACY_GUIDES_APPLICATION_RECIPIENT: [email protected]
Expand Down
11 changes: 10 additions & 1 deletion env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const env = createEnv({
SMTP_PORT: z.string().min(1),
SMTP_USER: z.string().min(1),
SMTP_PASS: z.string().min(1),
SES_VERIFIED_SENDER: z.string().email(),

STRIPE_MONERO_SECRET_KEY: z.string().min(1),
STRIPE_MONERO_WEBHOOK_SECRET: z.string().min(1),
Expand All @@ -42,7 +43,10 @@ export const env = createEnv({
BTCPAY_GENERAL_STORE_ID: z.string().min(1),
BTCPAY_GENERAL_WEBHOOK_SECRET: z.string().min(1),

SES_VERIFIED_SENDER: z.string().email(),
MONERO_APPLICATION_RECIPIENT: z.string().email(),
FIRO_APPLICATION_RECIPIENT: z.string().email(),
PRIVACY_GUIDES_APPLICATION_RECIPIENT: z.string().email(),
GENERAL_APPLICATION_RECIPIENT: z.string().email(),
},
/*
* Environment variables available on the client (and server).
Expand Down Expand Up @@ -97,6 +101,11 @@ export const env = createEnv({
BTCPAY_GENERAL_STORE_ID: process.env.BTCPAY_GENERAL_STORE_ID,
BTCPAY_GENERAL_WEBHOOK_SECRET: process.env.BTCPAY_GENERAL_WEBHOOK_SECRET,

MONERO_APPLICATION_RECIPIENT: process.env.MONERO_APPLICATION_RECIPIENT,
FIRO_APPLICATION_RECIPIENT: process.env.FIRO_APPLICATION_RECIPIENT,
PRIVACY_GUIDES_APPLICATION_RECIPIENT: process.env.PRIVACY_GUIDES_APPLICATION_RECIPIENT,
GENERAL_APPLICATION_RECIPIENT: process.env.GENERAL_APPLICATION_RECIPIENT,

NEXT_PUBLIC_MONERO_APPLICATION_RECIPIENT: process.env.NEXT_PUBLIC_MONERO_APPLICATION_RECIPIENT,
NEXT_PUBLIC_FIRO_APPLICATION_RECIPIENT: process.env.NEXT_PUBLIC_FIRO_APPLICATION_RECIPIENT,
NEXT_PUBLIC_PRIVACY_GUIDES_APPLICATION_RECIPIENT:
Expand Down
7 changes: 7 additions & 0 deletions server/utils/funds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ export const fundSlugToCustomerIdAttr: Record<FundSlug, string> = {
privacyguides: 'stripePgCustomerId',
general: 'stripeGeneralCustomerId',
}

export const fundSlugToRecipientEmail: Record<FundSlug, string> = {
monero: env.MONERO_APPLICATION_RECIPIENT,
firo: env.MONERO_APPLICATION_RECIPIENT,
privacyguides: env.MONERO_APPLICATION_RECIPIENT,
general: env.MONERO_APPLICATION_RECIPIENT,
}

0 comments on commit 905d30a

Please sign in to comment.