Commit 795975c
authored
Improve secret parameter support for firebase functions. (#9335)
* Improve secret parameter support for firebase functions.
Key changes:
- Added --format flag to functions:secrets:set command
- Auto-detect JSON format from .json file extensions
- Added format field to SecretParam interface for deploy-time handling
- Use visible input() prompt for JSON secrets vs password() for regular secrets
- Validate JSON format before storing in Secret Manager
- Improved error messages with actionable commands for developers
- Added non-interactive mode check with helpful error for missing secrets
Example usage:
firebase functions:secrets:set STRIPE_CONFIG --format=json --data-file config.json
cat config.json | firebase functions:secrets:set STRIPE_CONFIG --format=json
* Address code review feedback for functions-secrets-set command
- Include parse error message in JSON validation errors for better debugging
- Remove redundant --format=json flag from error suggestions (auto-detected from .json extension)
- Use consistent <file.json> placeholder instead of config.json in examples
- Implement custom secret reading logic to handle file/stdin/interactive input
- Keep all interactive secrets hidden using password() for security (including JSON)
* Address code review feedback for deploy-time secret params
- Include parse error message in JSON validation errors for better debugging
- Remove redundant --format=json flag from error suggestions (auto-detected from .json extension)
- Use consistent <file.json> placeholder instead of config.json in examples
- Keep all interactive secrets hidden using password() for security (including JSON)
* Formatting.
* Add CHANGELOG entry for JSON secrets support
* Extract JSON secret validation to shared function
Move validateJsonSecret to src/functions/secrets.ts to adhere to DRY principle and improve maintainability. This avoids duplicating the same validation logic and error messages across multiple files.
* formatting.
* make better use of existing utiliyt.
* nit: organize import.1 parent b119293 commit 795975c
File tree
5 files changed
+85
-12
lines changed- src
- commands
- deploy/functions
- functions
5 files changed
+85
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | | - | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
48 | 72 | | |
49 | 73 | | |
50 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
227 | 231 | | |
228 | 232 | | |
229 | 233 | | |
| |||
390 | 394 | | |
391 | 395 | | |
392 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
393 | 414 | | |
394 | 415 | | |
395 | 416 | | |
| |||
398 | 419 | | |
399 | 420 | | |
400 | 421 | | |
401 | | - | |
| 422 | + | |
402 | 423 | | |
403 | 424 | | |
404 | 425 | | |
| |||
460 | 481 | | |
461 | 482 | | |
462 | 483 | | |
463 | | - | |
| 484 | + | |
464 | 485 | | |
465 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
466 | 493 | | |
467 | | - | |
468 | | - | |
469 | | - | |
| 494 | + | |
470 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
471 | 499 | | |
472 | 500 | | |
473 | | - | |
| 501 | + | |
474 | 502 | | |
475 | 503 | | |
476 | 504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
90 | 110 | | |
91 | 111 | | |
92 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
893 | | - | |
| 893 | + | |
894 | 894 | | |
895 | 895 | | |
896 | 896 | | |
| |||
0 commit comments