mempool-startos/scripts/procedures/setConfig.ts
Lucy a476b47423
Integration/2.5.0.5 (#26)
* rename scripts folder to procedures

* update embassy to start commands

* bump package and lnd version
2023-10-24 19:00:36 -04:00

30 lines
937 B
TypeScript

import { compat, types as T } from "../deps.ts";
// Define a custom type for T.Config to include the 'lightning' property with a 'type' property
interface CustomConfig extends T.Config {
lightning?: {
type?: string;
};
}
// deno-lint-ignore require-await
export const setConfig: T.ExpectedExports.setConfig = async (
effects: T.Effects,
newConfig: CustomConfig
) => {
const dependsOnElectrs: { [key: string]: string[] } = newConfig?.[
"enable-electrs"
]
? { electrs: ["synced"] }
: {};
// add two const depsLnd and depsCln for the new lightning type string in getConfig
const depsLnd: { [key: string]: string[] } = newConfig?.lightning?.type === "lnd" ? {lnd: []} : {};
const depsCln: { [key: string]: string[] } = newConfig?.lightning?.type === "cln" ? {"c-lightning": []} : {};
return compat.setConfig(effects, newConfig, {
...dependsOnElectrs,
...depsLnd,
...depsCln,
});
};