make dev setup better (#116)

* make dev setup better

* chage docs

* remove the need of github login
This commit is contained in:
KM Koushik
2025-03-17 21:33:43 +11:00
committed by GitHub
parent 8b9d81ab2a
commit 0a1d93ac60
13 changed files with 129 additions and 74 deletions

View File

@@ -44,13 +44,17 @@ declare module "next-auth" {
* Auth providers
*/
const providers: Provider[] = [
GitHubProvider({
clientId: env.GITHUB_ID,
clientSecret: env.GITHUB_SECRET,
allowDangerousEmailAccountLinking: true,
}),
];
const providers: Provider[] = [];
if (env.GITHUB_ID && env.GITHUB_SECRET) {
providers.push(
GitHubProvider({
clientId: env.GITHUB_ID,
clientSecret: env.GITHUB_SECRET,
allowDangerousEmailAccountLinking: true,
})
);
}
if (env.GOOGLE_CLIENT_ID && env.GOOGLE_CLIENT_SECRET) {
providers.push(
@@ -76,6 +80,10 @@ if (env.FROM_EMAIL) {
);
}
if (providers.length === 0) {
throw new Error("No auth providers found, need atleast one");
}
/**
* Options for NextAuth.js used to configure adapters, providers, callbacks, etc.
*
@@ -100,7 +108,7 @@ export const authOptions: NextAuthOptions = {
events: {
createUser: async ({ user }) => {
// No waitlist for self hosting
if (!env.NEXT_PUBLIC_IS_CLOUD) {
if (!env.NEXT_PUBLIC_IS_CLOUD || env.NODE_ENV === "development") {
await db.user.update({
where: { id: user.id },
data: { isBetaUser: true },

View File

@@ -8,6 +8,7 @@ import { env } from "~/env";
function getSnsClient(region: string) {
return new SNSClient({
endpoint: env.AWS_SNS_ENDPOINT,
region: region,
credentials: {
accessKeyId: env.AWS_ACCESS_KEY,
@@ -44,6 +45,5 @@ export async function subscribeEndpoint(
const client = getSnsClient(region);
const data = await client.send(subscribeCommand);
console.log(data.SubscriptionArn);
return data.SubscriptionArn;
}

View File

@@ -18,7 +18,7 @@ export async function sendSignUpEmail(
const { host } = new URL(url);
if (env.NODE_ENV === "development") {
console.log("Sending sign in email", email, url, token);
console.log("Sending sign in email", { email, url, token });
return;
}

View File

@@ -131,9 +131,10 @@ export class SesSettingsService {
try {
await sns.deleteTopic(topicArn, region);
} catch (deleteError) {
console.error('Failed to delete SNS topic after error:', deleteError);
console.error("Failed to delete SNS topic after error:", deleteError);
}
}
console.error("Failed to create SES setting", error);
throw error;
}
}