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

chore: update ctx.userConfig -> ctx.config #111

Merged
merged 1 commit into from
Jun 19, 2024
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
6 changes: 3 additions & 3 deletions modules/auth/scripts/auth_email_passwordless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function run(
): Promise<Response> {
await ctx.modules.rateLimit.throttlePublic({});

if (!ctx.userConfig.email) throw new RuntimeError("provider_disabled");
if (!ctx.config.email) throw new RuntimeError("provider_disabled");

// Check if the email is already associated with an identity
const existingIdentity = await ctx.db.emailPasswordless.findFirst({
Expand Down Expand Up @@ -57,8 +57,8 @@ export async function run(
// Send email
await ctx.modules.email.sendEmail({
from: {
email: ctx.userConfig.email.fromEmail ?? "[email protected]",
name: ctx.userConfig.email.fromName ?? "Authentication Code",
email: ctx.config.email.fromEmail ?? "[email protected]",
name: ctx.config.email.fromName ?? "Authentication Code",
},
to: [{ email: req.email }],
subject: "Your verification code",
Expand Down
6 changes: 3 additions & 3 deletions modules/email/scripts/send_email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export async function run(
throw new RuntimeError("email_missing_content");
}

if ("test" in ctx.userConfig.provider) {
if ("test" in ctx.config.provider) {
// Do nothing
} else if ("sendGrid" in ctx.userConfig.provider) {
await useSendGrid(ctx.userConfig.provider.sendGrid, req);
} else if ("sendGrid" in ctx.config.provider) {
await useSendGrid(ctx.config.provider.sendGrid, req);
} else {
throw new RuntimeError("unreachable");
}
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function run(
ctx: ScriptContext,
req: Request,
): Promise<Response> {
const config = getConfig(ctx.userConfig);
const config = getConfig(ctx.config);

const newUpload = await ctx.db.$transaction(async (db) => {
// Find the upload by ID
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function run(
ctx: ScriptContext,
req: Request,
): Promise<Response> {
const config = getConfig(ctx.userConfig);
const config = getConfig(ctx.config);

const bytesDeleted = await ctx.db.$transaction(async (db) => {
const upload = await db.upload.findFirst({
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function run(
ctx: ScriptContext,
req: Request,
): Promise<Response> {
getConfig(ctx.userConfig);
getConfig(ctx.config);

// Find uploads that match the IDs in the request
const dbUploads = await ctx.db.upload.findMany({
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/get_public_file_urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function run(
ctx: ScriptContext,
req: Request,
): Promise<Response> {
const config = getConfig(ctx.userConfig);
const config = getConfig(ctx.config);

const dbFiles = await ctx.db.files.findMany({
where: {
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function run(
ctx: ScriptContext,
req: Request,
): Promise<Response> {
const config = getConfig(ctx.userConfig);
const config = getConfig(ctx.config);

// Ensure there are files in the upload
if (req.files.length === 0) {
Expand Down
Loading