(partial: AppConfigPortable)
| 634 | |
| 635 | /** Merge a partial portable config into the cache and persist it atomically. */ |
| 636 | export function setPortableConfig(partial: AppConfigPortable): Promise<void> { |
| 637 | cache = { ...cache, ...partial } |
| 638 | const text = serializeConfig(cache) |
| 639 | writeQueue = writeQueue |
| 640 | .catch(() => {}) |
| 641 | .then(async () => { |
| 642 | if (text === lastKnownText) return |
| 643 | // Set before writing so the watcher event this triggers is recognized |
| 644 | // as our own and ignored. |
| 645 | lastKnownText = text |
| 646 | rememberOwnWrite(text) |
| 647 | try { |
| 648 | await writeFileAtomic(getConfigFilePath(), text) |
| 649 | } catch (err) { |
| 650 | console.error('Failed to write config.toml', err) |
| 651 | } |
| 652 | }) |
| 653 | return writeQueue |
| 654 | } |
| 655 | |
| 656 | /** Ensure the file exists on disk (writing the current cache if missing) and |
| 657 | * return its path. Used by the "Reveal config file" action. */ |
no test coverage detected