diff --git a/cli/package.json b/cli/package.json index dadff21..a09897a 100644 --- a/cli/package.json +++ b/cli/package.json @@ -32,5 +32,5 @@ "parse-github-url": "^1.0.2", "prisma": "^5.14.0" }, - "version": "0.0.2" + "version": "0.0.3" } diff --git a/cli/src/utils/getCredentials.ts b/cli/src/utils/getCredentials.ts index 4d6d68b..a8857da 100644 --- a/cli/src/utils/getCredentials.ts +++ b/cli/src/utils/getCredentials.ts @@ -1,3 +1,3 @@ export function GetCredentials(sessionToken: string) { - return `next-auth.session-token=${sessionToken}`; + return `__Secure-next-auth.session-token=${sessionToken}`; } diff --git a/cli/src/utils/updateEnv.ts b/cli/src/utils/updateEnv.ts index d3e537d..9d13761 100644 --- a/cli/src/utils/updateEnv.ts +++ b/cli/src/utils/updateEnv.ts @@ -1,3 +1,4 @@ +import { existsSync } from "fs"; import { readFile, writeFile } from "fs/promises"; export default async function updateExistingEnvVariable( @@ -7,7 +8,7 @@ export default async function updateExistingEnvVariable( try { // Path to the .env file const filePath = ".env"; - const content = await readFile(filePath); + const content = existsSync(filePath) ? await readFile(filePath) : ""; // Split the content into lines const lines = content.toString().split("\n"); @@ -32,7 +33,7 @@ export default async function updateExistingEnvVariable( const updatedContent = updatedLines.join("\n"); // Write the updated contents back to the .env.example file - await writeFile(filePath, updatedContent); + await writeFile(filePath, updatedContent, { flag: "w+" }); //potentially add utf8 above if it fails const verifyContent = await readFile(filePath, "utf8"); return verifyContent.includes(`${varName}=${newValue}`); diff --git a/src/server/external/github.ts b/src/server/external/github.ts index cb29316..039b5ef 100644 --- a/src/server/external/github.ts +++ b/src/server/external/github.ts @@ -62,7 +62,7 @@ export async function CreateWebhook(repoUrl: string) { events: ["push", "pull_request"], config: { // to be replaced with actual webhook URL - url: `${process.env.NEXTAUTH_URL}/api/trpc/receive`, + url: `${process.env.NEXTAUTH_URL}/api/github`, content_type: "json", insecure_ssl: "1", },