* Step 3–5: merges CLI and config-file layers (`CLI > config file`), * validates conflicts and implications, and applies defaults.
(options: ServerConfigCreateOptions)
| 237 | * validates conflicts and implications, and applies defaults. |
| 238 | */ |
| 239 | static create(options: ServerConfigCreateOptions): ServerConfig { |
| 240 | const explicitArgs: Partial<ParsedArguments> = { |
| 241 | ...options.fileArgs, |
| 242 | ...options.cliArgs, |
| 243 | ...(options.configPath ? {config: options.configPath} : {}), |
| 244 | }; |
| 245 | ServerConfig.validateConflicts(explicitArgs); |
| 246 | ServerConfig.validateImplications(explicitArgs); |
| 247 | const resolved = ServerConfig.applyDefaults(explicitArgs, { |
| 248 | env: options.env, |
| 249 | suppressUsageStatisticsNotice: options.suppressUsageStatisticsNotice, |
| 250 | }); |
| 251 | return new ServerConfig({ |
| 252 | cliArgs: options.cliArgs, |
| 253 | fileArgs: options.fileArgs, |
| 254 | configPath: options.configPath, |
| 255 | env: options.env, |
| 256 | resolved, |
| 257 | }); |
| 258 | } |
| 259 | |
| 260 | get cliArgs(): Readonly<Partial<ParsedArguments>> { |
| 261 | return this.#cliArgs; |
no test coverage detected