File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 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
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');
You can’t perform that action at this time.
0 commit comments