mempool-startos/scripts/services/setConfig.ts
Dread defcb59123
V2.5.0 update, and replace submodule with docker images (#21)
* bump to v2.5.0

* wip

* wip

* v2.5.0 with docker images

* removed submodule

* fix CLN

* v2.5.0

* update deno deps

---------

Co-authored-by: islandbitcoin <dread@start9.com>
2023-04-20 17:45:16 -04:00

34 lines
1.0 KiB
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"] }
: {};
const dependsOnBitcoind: { [key: string]: string[] } = newConfig?.txindex
? { bitcoind: [] }
: {};
// 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,
...dependsOnBitcoind,
...depsLnd,
...depsCln,
});
};