Skip to content

Commit

Permalink
fix(setup): do not enter setup mode if HOST environment variable is…
Browse files Browse the repository at this point in the history
… set (#1538)
  • Loading branch information
kammerjaeger committed May 28, 2021
1 parent 6dec1fa commit 4d70d69
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/apps/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const setupAppFactory = (
// If not on Glitch or Production, create a smee URL
if (
process.env.NODE_ENV !== "production" &&
!(process.env.PROJECT_DOMAIN || process.env.WEBHOOK_PROXY_URL)
!(process.env.PROJECT_DOMAIN || process.env.WEBHOOK_PROXY_URL || host)
) {
await setup.createWebhookChannel();
}
Expand Down
4 changes: 3 additions & 1 deletion src/manifest-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ export class ManifestCreation {
options
);

const { id, webhook_secret, pem } = response.data;
const { id, client_id, client_secret, webhook_secret, pem } = response.data;
await this.updateEnv({
APP_ID: id.toString(),
PRIVATE_KEY: `"${pem}"`,
WEBHOOK_SECRET: webhook_secret,
GITHUB_CLIENT_ID: client_id,
GITHUB_CLIENT_SECRET: client_secret,
});

return response.data.html_url;
Expand Down
2 changes: 2 additions & 0 deletions test/apps/__snapshots__/setup.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Array [
Array [
Object {
"APP_ID": "id",
"GITHUB_CLIENT_ID": "Iv1.8a61f9b3a7aba766",
"GITHUB_CLIENT_SECRET": "1726be1638095a19edd134c77bde3aa2ece1e5d8",
"PRIVATE_KEY": "\\"pem\\"",
"WEBHOOK_SECRET": "webhook_secret",
},
Expand Down
2 changes: 2 additions & 0 deletions test/apps/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ describe("Setup app", () => {
id: "id",
pem: "pem",
webhook_secret: "webhook_secret",
client_id: "Iv1.8a61f9b3a7aba766",
client_secret: "1726be1638095a19edd134c77bde3aa2ece1e5d8",
});

await request(server.expressApp)
Expand Down

0 comments on commit 4d70d69

Please sign in to comment.