Skip to content

Commit 0fddce4

Browse files
committed
Rename admin oauth vars
1 parent 3108f54 commit 0fddce4

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

apps/dashboard/convex/dev.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ declare const process: { env: Record<string, string | undefined> };
1717
const SESSION_DURATION_MS = 30 * 24 * 60 * 60 * 1000;
1818

1919
/**
20-
* Throws if the current Convex deployment explicitly identifies itself as prod.
21-
* Convex does not automatically expose the local `.env.local` deployment marker
22-
* to function runtime env, so an unset value must still be allowed for dev.
20+
* Dev helpers refuse to run against production deployments.
2321
*/
2422
function assertDev(): void {
2523
const deployment = process.env.CONVEX_DEPLOYMENT;

apps/dashboard/convex/gmailOAuth.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const start = httpAction(async (ctx, request) => {
113113

114114
const redirectUri = getRedirectUri(request);
115115
const params = new URLSearchParams({
116-
client_id: getRequiredEnv("GOOGLE_OAUTH_CLIENT_ID"),
116+
client_id: getRequiredEnv("ADMIN_GOOGLE_OAUTH_CLIENT_ID"),
117117
redirect_uri: redirectUri,
118118
response_type: "code",
119119
scope: GMAIL_SCOPES.join(" "),
@@ -260,7 +260,7 @@ export const storeConnection = internalMutation({
260260
});
261261

262262
function getRedirectUri(request: Request) {
263-
const configured = process.env.GOOGLE_OAUTH_REDIRECT_URI;
263+
const configured = process.env.ADMIN_GOOGLE_OAUTH_REDIRECT_URI;
264264
if (configured) return configured;
265265

266266
const url = new URL(request.url);
@@ -270,8 +270,8 @@ function getRedirectUri(request: Request) {
270270
async function exchangeCodeForTokens(code: string, redirectUri: string) {
271271
const params = new URLSearchParams({
272272
code,
273-
client_id: getRequiredEnv("GOOGLE_OAUTH_CLIENT_ID"),
274-
client_secret: getRequiredEnv("GOOGLE_OAUTH_CLIENT_SECRET"),
273+
client_id: getRequiredEnv("ADMIN_GOOGLE_OAUTH_CLIENT_ID"),
274+
client_secret: getRequiredEnv("ADMIN_GOOGLE_OAUTH_CLIENT_SECRET"),
275275
redirect_uri: redirectUri,
276276
grant_type: "authorization_code",
277277
});

apps/dashboard/convex/ingestion.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,13 @@ async function refreshAccessToken(ctx: ActionCtx) {
479479
}
480480

481481
const refreshToken = connection.refreshToken;
482-
const clientId = process.env.GOOGLE_OAUTH_CLIENT_ID;
483-
const clientSecret = process.env.GOOGLE_OAUTH_CLIENT_SECRET;
482+
const clientId = process.env.ADMIN_GOOGLE_OAUTH_CLIENT_ID;
483+
const clientSecret = process.env.ADMIN_GOOGLE_OAUTH_CLIENT_SECRET;
484484

485485
if (!refreshToken || !clientId || !clientSecret) {
486-
throw new Error("Gmail OAuth client env vars are not configured.");
486+
throw new Error(
487+
"Admin ingestion Google OAuth client env vars are not configured.",
488+
);
487489
}
488490

489491
const params = new URLSearchParams({

apps/dashboard/convex/listservAdmin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,11 +1053,13 @@ async function getGmailConnection(ctx: ActionCtx) {
10531053
}
10541054

10551055
async function refreshGmailAccessToken(ctx: ActionCtx, refreshToken: string) {
1056-
const clientId = process.env.GOOGLE_OAUTH_CLIENT_ID;
1057-
const clientSecret = process.env.GOOGLE_OAUTH_CLIENT_SECRET;
1056+
const clientId = process.env.ADMIN_GOOGLE_OAUTH_CLIENT_ID;
1057+
const clientSecret = process.env.ADMIN_GOOGLE_OAUTH_CLIENT_SECRET;
10581058

10591059
if (!refreshToken || !clientId || !clientSecret) {
1060-
throw new Error("Gmail OAuth client env vars are not configured.");
1060+
throw new Error(
1061+
"Admin ingestion Google OAuth client env vars are not configured.",
1062+
);
10611063
}
10621064

10631065
const params = new URLSearchParams({

0 commit comments

Comments
 (0)