Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit c9e0f72

Browse files
authored
chore: update ctx.userConfig -> ctx.config (#111)
Required for OpenGB 0.2
1 parent 412d5c0 commit c9e0f72

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

modules/auth/scripts/auth_email_passwordless.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function run(
1717
): Promise<Response> {
1818
await ctx.modules.rateLimit.throttlePublic({});
1919

20-
if (!ctx.userConfig.email) throw new RuntimeError("provider_disabled");
20+
if (!ctx.config.email) throw new RuntimeError("provider_disabled");
2121

2222
// Check if the email is already associated with an identity
2323
const existingIdentity = await ctx.db.emailPasswordless.findFirst({
@@ -57,8 +57,8 @@ export async function run(
5757
// Send email
5858
await ctx.modules.email.sendEmail({
5959
from: {
60-
email: ctx.userConfig.email.fromEmail ?? "hello@test.com",
61-
name: ctx.userConfig.email.fromName ?? "Authentication Code",
60+
email: ctx.config.email.fromEmail ?? "hello@test.com",
61+
name: ctx.config.email.fromName ?? "Authentication Code",
6262
},
6363
to: [{ email: req.email }],
6464
subject: "Your verification code",

modules/email/scripts/send_email.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ export async function run(
2525
throw new RuntimeError("email_missing_content");
2626
}
2727

28-
if ("test" in ctx.userConfig.provider) {
28+
if ("test" in ctx.config.provider) {
2929
// Do nothing
30-
} else if ("sendGrid" in ctx.userConfig.provider) {
31-
await useSendGrid(ctx.userConfig.provider.sendGrid, req);
30+
} else if ("sendGrid" in ctx.config.provider) {
31+
await useSendGrid(ctx.config.provider.sendGrid, req);
3232
} else {
3333
throw new RuntimeError("unreachable");
3434
}

modules/uploads/scripts/complete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export async function run(
1919
ctx: ScriptContext,
2020
req: Request,
2121
): Promise<Response> {
22-
const config = getConfig(ctx.userConfig);
22+
const config = getConfig(ctx.config);
2323

2424
const newUpload = await ctx.db.$transaction(async (db) => {
2525
// Find the upload by ID

modules/uploads/scripts/delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function run(
1515
ctx: ScriptContext,
1616
req: Request,
1717
): Promise<Response> {
18-
const config = getConfig(ctx.userConfig);
18+
const config = getConfig(ctx.config);
1919

2020
const bytesDeleted = await ctx.db.$transaction(async (db) => {
2121
const upload = await db.upload.findFirst({

modules/uploads/scripts/get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export async function run(
1919
ctx: ScriptContext,
2020
req: Request,
2121
): Promise<Response> {
22-
getConfig(ctx.userConfig);
22+
getConfig(ctx.config);
2323

2424
// Find uploads that match the IDs in the request
2525
const dbUploads = await ctx.db.upload.findMany({

modules/uploads/scripts/get_public_file_urls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function run(
1717
ctx: ScriptContext,
1818
req: Request,
1919
): Promise<Response> {
20-
const config = getConfig(ctx.userConfig);
20+
const config = getConfig(ctx.config);
2121

2222
const dbFiles = await ctx.db.files.findMany({
2323
where: {

modules/uploads/scripts/prepare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export async function run(
2020
ctx: ScriptContext,
2121
req: Request,
2222
): Promise<Response> {
23-
const config = getConfig(ctx.userConfig);
23+
const config = getConfig(ctx.config);
2424

2525
// Ensure there are files in the upload
2626
if (req.files.length === 0) {

0 commit comments

Comments
 (0)