mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
addHealthCheck instead of additionalHealthChecks for Daemons (#2962)
* addHealthCheck on Daemons * fix bug that prevents domains without protocols from being deleted * fixes from testing * version bump * add sdk version to UI * fix useEntrypoint * fix dependency health check error display * minor fixes * beta.29 * fixes from testing * beta.30 * set /etc/os-release (#2918) * remove check-monitor from kiosk (#2059) * add units for progress (#2693) * use new progress type * alpha.7 * fix up pwa stuff * fix wormhole-squashfs and prune boot (#2964) * don't exit on expected errors * use bash --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
This commit is contained in:
@@ -340,9 +340,17 @@ export class FileHelper<A> {
|
||||
/**
|
||||
* Accepts full structured data and overwrites the existing file on disk if it exists.
|
||||
*/
|
||||
async write(effects: T.Effects, data: T.AllowReadonly<A> | A) {
|
||||
async write(
|
||||
effects: T.Effects,
|
||||
data: T.AllowReadonly<A> | A,
|
||||
options: { allowWriteAfterConst?: boolean } = {},
|
||||
) {
|
||||
await this.writeFile(this.validate(data))
|
||||
if (effects.constRetry && this.consts.includes(effects.constRetry))
|
||||
if (
|
||||
!options.allowWriteAfterConst &&
|
||||
effects.constRetry &&
|
||||
this.consts.includes(effects.constRetry)
|
||||
)
|
||||
throw new Error(`Canceled: write after const: ${this.path}`)
|
||||
return null
|
||||
}
|
||||
@@ -350,7 +358,11 @@ export class FileHelper<A> {
|
||||
/**
|
||||
* Accepts partial structured data and performs a merge with the existing file on disk.
|
||||
*/
|
||||
async merge(effects: T.Effects, data: T.AllowReadonly<T.DeepPartial<A>>) {
|
||||
async merge(
|
||||
effects: T.Effects,
|
||||
data: T.AllowReadonly<T.DeepPartial<A>>,
|
||||
options: { allowWriteAfterConst?: boolean } = {},
|
||||
) {
|
||||
const fileDataRaw = await this.readFileRaw()
|
||||
let fileData: any = fileDataRaw === null ? null : this.readData(fileDataRaw)
|
||||
try {
|
||||
@@ -360,7 +372,11 @@ export class FileHelper<A> {
|
||||
const toWrite = this.writeData(mergeData)
|
||||
if (toWrite !== fileDataRaw) {
|
||||
this.writeFile(mergeData)
|
||||
if (effects.constRetry && this.consts.includes(effects.constRetry)) {
|
||||
if (
|
||||
!options.allowWriteAfterConst &&
|
||||
effects.constRetry &&
|
||||
this.consts.includes(effects.constRetry)
|
||||
) {
|
||||
const diff = partialDiff(fileData, mergeData as any)
|
||||
if (!diff) {
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user