* Get the path to config.example.json * Checks mounted volume first, then falls back to image built-in template * @returns {string} Path to config.example.json * @throws {Error} If config.example.json not found in either location
()
| 79 | * @throws {Error} If config.example.json not found in either location |
| 80 | */ |
| 81 | getConfigExamplePath() { |
| 82 | const configDir = path.dirname(this.configPath); |
| 83 | |
| 84 | // First check mounted volume (user's custom config.example.json) |
| 85 | const volumePath = path.join(configDir, 'config.example.json'); |
| 86 | if (fs.existsSync(volumePath)) { |
| 87 | logger.info({ path: volumePath }, 'Using config.example.json from mounted volume'); |
| 88 | return volumePath; |
| 89 | } |
| 90 | |
| 91 | // Fall back to image built-in template (guaranteed to exist in /app/server/) |
| 92 | const templatePath = path.join(__dirname, '../config.example.json'); |
| 93 | if (fs.existsSync(templatePath)) { |
| 94 | logger.info({ path: templatePath }, 'Using config.example.json from image template'); |
| 95 | return templatePath; |
| 96 | } |
| 97 | |
| 98 | // Error - config.example.json is required |
| 99 | const error = new Error( |
| 100 | 'config.example.json not found in either mounted volume or image template. ' + |
| 101 | 'This file is required for configuration initialization.' |
| 102 | ); |
| 103 | logger.error({ volumePath, templatePath }, 'config.example.json not found'); |
| 104 | throw error; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Deep merge two objects, preserving existing values and adding missing ones from template |
no outgoing calls
no test coverage detected