Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CLI and Webhook path #29

Merged
merged 3 commits into from
Jun 20, 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
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
"parse-github-url": "^1.0.2",
"prisma": "^5.14.0"
},
"version": "0.0.2"
"version": "0.0.3"
}
2 changes: 1 addition & 1 deletion cli/src/utils/getCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function GetCredentials(sessionToken: string) {
return `next-auth.session-token=${sessionToken}`;
return `__Secure-next-auth.session-token=${sessionToken}`;
}
5 changes: 3 additions & 2 deletions cli/src/utils/updateEnv.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { existsSync } from "fs";
import { readFile, writeFile } from "fs/promises";

export default async function updateExistingEnvVariable(
Expand All @@ -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");
Expand All @@ -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}`);
Expand Down
2 changes: 1 addition & 1 deletion src/server/external/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down