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 },