mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
Feature/dependency autoconfig (#2588)
* dependency autoconfig * FE portion --------- Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
@@ -1410,7 +1410,6 @@ export module Mock {
|
||||
started: new Date().toISOString(),
|
||||
health: {},
|
||||
},
|
||||
dependencyConfigErrors: {},
|
||||
},
|
||||
actions: {}, // @TODO need mocks
|
||||
serviceInterfaces: {
|
||||
@@ -1650,7 +1649,6 @@ export module Mock {
|
||||
main: {
|
||||
status: 'stopped',
|
||||
},
|
||||
dependencyConfigErrors: {},
|
||||
},
|
||||
actions: {},
|
||||
serviceInterfaces: {
|
||||
@@ -1770,6 +1768,7 @@ export module Mock {
|
||||
registryUrl: '',
|
||||
versionSpec: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
configSatisfied: true,
|
||||
},
|
||||
},
|
||||
hosts: {},
|
||||
@@ -1790,9 +1789,6 @@ export module Mock {
|
||||
main: {
|
||||
status: 'stopped',
|
||||
},
|
||||
dependencyConfigErrors: {
|
||||
'btc-rpc-proxy': 'Username not found',
|
||||
},
|
||||
},
|
||||
actions: {},
|
||||
serviceInterfaces: {
|
||||
@@ -2015,6 +2011,7 @@ export module Mock {
|
||||
registryUrl: 'https://registry.start9.com',
|
||||
versionSpec: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
configSatisfied: true,
|
||||
},
|
||||
'btc-rpc-proxy': {
|
||||
title: Mock.MockManifestBitcoinProxy.title,
|
||||
@@ -2022,6 +2019,7 @@ export module Mock {
|
||||
kind: 'exists',
|
||||
registryUrl: 'https://community-registry.start9.com',
|
||||
versionSpec: '>2.0.0', // @TODO
|
||||
configSatisfied: false,
|
||||
},
|
||||
},
|
||||
hosts: {},
|
||||
|
||||
@@ -125,7 +125,6 @@ export const mockPatchData: DataModel = {
|
||||
},
|
||||
},
|
||||
},
|
||||
dependencyConfigErrors: {},
|
||||
},
|
||||
actions: {}, // @TODO
|
||||
serviceInterfaces: {
|
||||
@@ -367,9 +366,6 @@ export const mockPatchData: DataModel = {
|
||||
main: {
|
||||
status: 'stopped',
|
||||
},
|
||||
dependencyConfigErrors: {
|
||||
'btc-rpc-proxy': 'This is a config unsatisfied error',
|
||||
},
|
||||
},
|
||||
actions: {},
|
||||
serviceInterfaces: {
|
||||
@@ -590,6 +586,7 @@ export const mockPatchData: DataModel = {
|
||||
registryUrl: 'https://registry.start9.com',
|
||||
versionSpec: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
configSatisfied: true,
|
||||
},
|
||||
'btc-rpc-proxy': {
|
||||
title: 'Bitcoin Proxy',
|
||||
@@ -598,6 +595,7 @@ export const mockPatchData: DataModel = {
|
||||
registryUrl: 'https://community-registry.start9.com',
|
||||
versionSpec: '>2.0.0',
|
||||
healthChecks: [],
|
||||
configSatisfied: false,
|
||||
},
|
||||
},
|
||||
hosts: {},
|
||||
|
||||
@@ -83,20 +83,20 @@ export class DepErrorService {
|
||||
}
|
||||
}
|
||||
|
||||
const versionSpec = pkg.currentDependencies[depId].versionSpec
|
||||
const currentDep = pkg.currentDependencies[depId]
|
||||
const depManifest = dep.stateInfo.manifest
|
||||
|
||||
// incorrect version
|
||||
if (!this.emver.satisfies(depManifest.version, versionSpec)) {
|
||||
if (!this.emver.satisfies(depManifest.version, currentDep.versionSpec)) {
|
||||
return {
|
||||
type: 'incorrectVersion',
|
||||
expected: versionSpec,
|
||||
expected: currentDep.versionSpec,
|
||||
received: depManifest.version,
|
||||
}
|
||||
}
|
||||
|
||||
// invalid config
|
||||
if (Object.values(pkg.status.dependencyConfigErrors).some(err => !!err)) {
|
||||
if (!currentDep.configSatisfied) {
|
||||
return {
|
||||
type: 'configUnsatisfied',
|
||||
}
|
||||
@@ -111,8 +111,6 @@ export class DepErrorService {
|
||||
}
|
||||
}
|
||||
|
||||
const currentDep = pkg.currentDependencies[depId]
|
||||
|
||||
// health check failure
|
||||
if (depStatus === 'running' && currentDep.kind === 'running') {
|
||||
for (let id of currentDep.healthChecks) {
|
||||
|
||||
Reference in New Issue
Block a user