@eide/foir-cli 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +26 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4994,11 +4994,32 @@ function registerPushCommand(program2, globalOpts) {
|
|
|
4994
4994
|
}
|
|
4995
4995
|
const { secret: signingSecret } = await client.operations.getSigningSecret();
|
|
4996
4996
|
if (signingSecret) {
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
4997
|
+
const envPath2 = resolve4(opts.env ?? ".env");
|
|
4998
|
+
const envContent = existsSync4(envPath2) ? readFileSync(envPath2, "utf-8") : "";
|
|
4999
|
+
const currentMatch = envContent.match(/^FOIR_WEBHOOK_SECRET=(.*)$/m);
|
|
5000
|
+
const currentValue = currentMatch?.[1];
|
|
5001
|
+
if (currentValue !== signingSecret) {
|
|
5002
|
+
if (currentMatch) {
|
|
5003
|
+
const updated = envContent.replace(
|
|
5004
|
+
/^FOIR_WEBHOOK_SECRET=.*$/m,
|
|
5005
|
+
`FOIR_WEBHOOK_SECRET=${signingSecret}`
|
|
5006
|
+
);
|
|
5007
|
+
writeFileSync2(envPath2, updated, "utf-8");
|
|
5008
|
+
console.log(
|
|
5009
|
+
chalk6.yellow("\u27F3 Webhook signing secret") + chalk6.dim(` \u2192 FOIR_WEBHOOK_SECRET updated in ${envPath2}`)
|
|
5010
|
+
);
|
|
5011
|
+
} else {
|
|
5012
|
+
envWrites.push({
|
|
5013
|
+
key: "FOIR_WEBHOOK_SECRET",
|
|
5014
|
+
value: signingSecret,
|
|
5015
|
+
label: "Webhook signing secret"
|
|
5016
|
+
});
|
|
5017
|
+
}
|
|
5018
|
+
} else {
|
|
5019
|
+
console.log(
|
|
5020
|
+
chalk6.dim(" Webhook signing secret: FOIR_WEBHOOK_SECRET already up to date, skipped")
|
|
5021
|
+
);
|
|
5022
|
+
}
|
|
5002
5023
|
}
|
|
5003
5024
|
if (envWrites.length > 0) {
|
|
5004
5025
|
console.log();
|