remove sensitive config
This commit is contained in:
@@ -17,9 +17,6 @@ import { env } from "./env.js";
|
|||||||
import { getDbClient } from "../database/index.js";
|
import { getDbClient } from "../database/index.js";
|
||||||
import { JWT } from "@auth/core/jwt";
|
import { JWT } from "@auth/core/jwt";
|
||||||
|
|
||||||
const POSTGRES_CONNECTION_STRING =
|
|
||||||
"postgres://neondb_owner:npg_sOVmj8vWq2zG@ep-withered-king-adiz9gpi-pooler.c-2.us-east-1.aws.neon.tech:5432/neondb?sslmode=require&channel_binding=true";
|
|
||||||
|
|
||||||
if (!globalThis.crypto) {
|
if (!globalThis.crypto) {
|
||||||
/**
|
/**
|
||||||
* Polyfill needed if Auth.js code runs on node18
|
* Polyfill needed if Auth.js code runs on node18
|
||||||
@@ -40,7 +37,7 @@ const authjsConfig = {
|
|||||||
// ),
|
// ),
|
||||||
trustHost: true,
|
trustHost: true,
|
||||||
// TODO: Replace secret {@see https://authjs.dev/reference/core#secret}
|
// TODO: Replace secret {@see https://authjs.dev/reference/core#secret}
|
||||||
secret: "buginoo",
|
secret: env.AUTHJS_SECRET,
|
||||||
providers: [
|
providers: [
|
||||||
// TODO: Choose and implement providers
|
// TODO: Choose and implement providers
|
||||||
// CredentialsProvider({
|
// CredentialsProvider({
|
||||||
@@ -64,15 +61,15 @@ const authjsConfig = {
|
|||||||
// },
|
// },
|
||||||
// }),
|
// }),
|
||||||
GoogleProvider({
|
GoogleProvider({
|
||||||
clientId:
|
clientId: env.GOOGLE_CLIENT_ID,
|
||||||
"697711350664-t6237s5n3ttjd1npp1qif1aupptkr0va.apps.googleusercontent.com",
|
clientSecret: env.GOOGLE_CLIENT_SECRET,
|
||||||
clientSecret: "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",
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
callbacks: {
|
callbacks: {
|
||||||
async signIn({ user, account, profile }) {
|
async signIn({ user, account, profile }) {
|
||||||
if (typeof user?.email !== "string") return false;
|
if (typeof user?.email !== "string") return false;
|
||||||
const dbClient = await getDbClient(POSTGRES_CONNECTION_STRING);
|
//@ts-ignore
|
||||||
|
const dbClient = await getDbClient(env.POSTGRES_CONNECTION_STRING);
|
||||||
let userFromDb = await dbClient
|
let userFromDb = await dbClient
|
||||||
.selectFrom("users")
|
.selectFrom("users")
|
||||||
.selectAll()
|
.selectAll()
|
||||||
@@ -98,7 +95,8 @@ const authjsConfig = {
|
|||||||
},
|
},
|
||||||
jwt: async ({ token }) => {
|
jwt: async ({ token }) => {
|
||||||
if (typeof token?.email !== "string") return token;
|
if (typeof token?.email !== "string") return token;
|
||||||
const dbClient = await getDbClient(POSTGRES_CONNECTION_STRING);
|
//@ts-ignore
|
||||||
|
const dbClient = await getDbClient(env.POSTGRES_CONNECTION_STRING);
|
||||||
let userFromDb = await dbClient
|
let userFromDb = await dbClient
|
||||||
.selectFrom("users")
|
.selectFrom("users")
|
||||||
.selectAll()
|
.selectAll()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const trpcHandler = ((endpoint) => (request, context, runtime) => {
|
|||||||
);
|
);
|
||||||
const jwt = await getToken({
|
const jwt = await getToken({
|
||||||
req,
|
req,
|
||||||
secret: "buginoo",
|
secret: processEnv.AUTHJS_SECRET,
|
||||||
/** Needed to specify cookie name because for some reason in production
|
/** Needed to specify cookie name because for some reason in production
|
||||||
* it wasn't reading the correct cookie but in development it was. It
|
* it wasn't reading the correct cookie but in development it was. It
|
||||||
* was not straightforward to fix the name of the cookie in
|
* was not straightforward to fix the name of the cookie in
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ MILVUS_USERNAME = "db_639fdba4bcde098"
|
|||||||
[env.production.vars]
|
[env.production.vars]
|
||||||
MILVUS_ADDRESS = "in03-639fdba4bcde098.serverless.gcp-us-west1.cloud.zilliz.com"
|
MILVUS_ADDRESS = "in03-639fdba4bcde098.serverless.gcp-us-west1.cloud.zilliz.com"
|
||||||
MILVUS_USERNAME = "db_639fdba4bcde098"
|
MILVUS_USERNAME = "db_639fdba4bcde098"
|
||||||
|
GOOGLE_CLIENT_ID = "697711350664-t6237s5n3ttjd1npp1qif1aupptkr0va.apps.googleusercontent.com"
|
||||||
NODE_ENV = "production"
|
NODE_ENV = "production"
|
||||||
|
|
||||||
[env.preview.vars]
|
[env.preview.vars]
|
||||||
|
|||||||
Reference in New Issue
Block a user