mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
fix dependency autoconfig
This commit is contained in:
@@ -348,12 +348,7 @@ export class SystemForEmbassy implements System {
|
|||||||
options.timeout || null,
|
options.timeout || null,
|
||||||
)
|
)
|
||||||
case procedures[1] === "dependencies" && procedures[3] === "query":
|
case procedures[1] === "dependencies" && procedures[3] === "query":
|
||||||
return this.dependenciesAutoconfig(
|
return null
|
||||||
effects,
|
|
||||||
procedures[2],
|
|
||||||
input,
|
|
||||||
options.timeout || null,
|
|
||||||
)
|
|
||||||
|
|
||||||
case procedures[1] === "dependencies" && procedures[3] === "update":
|
case procedures[1] === "dependencies" && procedures[3] === "update":
|
||||||
return this.dependenciesAutoconfig(
|
return this.dependenciesAutoconfig(
|
||||||
@@ -836,9 +831,9 @@ export class SystemForEmbassy implements System {
|
|||||||
id: string,
|
id: string,
|
||||||
oldConfig: unknown,
|
oldConfig: unknown,
|
||||||
timeoutMs: number | null,
|
timeoutMs: number | null,
|
||||||
): Promise<object> {
|
): Promise<any> {
|
||||||
const actionProcedure = this.manifest.dependencies?.[id]?.config?.check
|
const actionProcedure = this.manifest.dependencies?.[id]?.config?.check
|
||||||
if (!actionProcedure) return { message: "Action not found", value: null }
|
if (!actionProcedure) return null
|
||||||
if (actionProcedure.type === "docker") {
|
if (actionProcedure.type === "docker") {
|
||||||
const container = await DockerProcedureContainer.of(
|
const container = await DockerProcedureContainer.of(
|
||||||
effects,
|
effects,
|
||||||
@@ -880,16 +875,19 @@ export class SystemForEmbassy implements System {
|
|||||||
private async dependenciesAutoconfig(
|
private async dependenciesAutoconfig(
|
||||||
effects: Effects,
|
effects: Effects,
|
||||||
id: string,
|
id: string,
|
||||||
oldConfig: unknown,
|
input: unknown,
|
||||||
timeoutMs: number | null,
|
timeoutMs: number | null,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const oldConfig = object({ remoteConfig: any }).unsafeCast(
|
||||||
|
input,
|
||||||
|
).remoteConfig
|
||||||
// TODO: docker
|
// TODO: docker
|
||||||
const moduleCode = await this.moduleCode
|
const moduleCode = await this.moduleCode
|
||||||
const method = moduleCode.dependencies?.[id]?.autoConfigure
|
const method = moduleCode.dependencies?.[id]?.autoConfigure
|
||||||
if (!method) return
|
if (!method) return
|
||||||
return (await method(
|
return (await method(
|
||||||
polyfillEffects(effects, this.manifest),
|
polyfillEffects(effects, this.manifest),
|
||||||
oldConfig as any,
|
oldConfig,
|
||||||
).then((x) => {
|
).then((x) => {
|
||||||
if ("result" in x) return x.result
|
if ("result" in x) return x.result
|
||||||
if ("error" in x) throw new Error("Error getting config: " + x.error)
|
if ("error" in x) throw new Error("Error getting config: " + x.error)
|
||||||
|
|||||||
Reference in New Issue
Block a user