| 1 | import program from './commander'; |
| 2 | |
| 3 | function logStartupOptions(options) { |
| 4 | if (!options.verbose) { |
| 5 | return; |
| 6 | } |
| 7 | // Keys that may include sensitive information that will be redacted in logs |
| 8 | const keysToRedact = [ |
| 9 | 'databaseAdapter', |
| 10 | 'databaseURI', |
| 11 | 'masterKey', |
| 12 | 'maintenanceKey', |
| 13 | 'push', |
| 14 | ]; |
| 15 | for (const key in options) { |
| 16 | let value = options[key]; |
| 17 | if (keysToRedact.includes(key)) { |
| 18 | value = '<REDACTED>'; |
| 19 | } |
| 20 | if (typeof value === 'object') { |
| 21 | try { |
| 22 | value = JSON.stringify(value); |
| 23 | } catch { |
| 24 | if (value && value.constructor && value.constructor.name) { |
| 25 | value = value.constructor.name; |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | /* eslint-disable no-console */ |
| 30 | console.log(`${key}: ${value}`); |
| 31 | /* eslint-enable no-console */ |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | export default function ({ definitions, help, usage, start }) { |
| 36 | program.loadDefinitions(definitions); |