Skip to content

Commit 07a0633

Browse files
Fix: Update wrangler.jsonc update script to remove sensitive data and clean up trailing commas
1 parent dd709f2 commit 07a0633

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
- name: Update wrangler config with environment variables
3434
run: |
35-
# Create script to update wrangler.jsonc using string replacement
35+
# Create script to update wrangler.jsonc - remove secrets and set vars
3636
cat > update_config.cjs << 'EOF'
3737
const fs = require('fs');
3838
@@ -47,6 +47,16 @@ jobs:
4747
content = content.replace(/"SMTP_PORT":\s*"[^"]*"/, `"SMTP_PORT": "${process.env.SMTP_PORT}"`);
4848
content = content.replace(/"SMTP_USER":\s*"[^"]*"/, `"SMTP_USER": "${process.env.SMTP_USER}"`);
4949
50+
// Remove sensitive data from vars (these will be secrets instead)
51+
content = content.replace(/"ADMIN_PASSWORD":\s*"[^"]*",?\s*/, '');
52+
content = content.replace(/"MOODLE_API_TOKEN":\s*"[^"]*",?\s*/, '');
53+
content = content.replace(/"SMTP_PASS":\s*"[^"]*",?\s*/, '');
54+
content = content.replace(/"JWT_SECRET":\s*"[^"]*",?\s*/, '');
55+
content = content.replace(/"GOOGLE_API_KEY":\s*{[^}]*},?\s*/, '');
56+
57+
// Clean up any trailing commas in vars section
58+
content = content.replace(/("vars":\s*{[^}]*),\s*}/, '$1}');
59+
5060
// Write back the modified content
5161
fs.writeFileSync('wrangler.jsonc', content);
5262
console.log('Successfully updated wrangler.jsonc with environment variables');

0 commit comments

Comments
 (0)