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