From 908e8f20669e03df68d6bf6ff9ff7329ce629d48 Mon Sep 17 00:00:00 2001 From: pablomendezroyo Date: Thu, 28 Sep 2023 12:39:35 +0200 Subject: [PATCH] use static method --- .../dappmanager/src/modules/optimism/getOptimismConfig.ts | 4 ++-- ...timismNodeRpcUrl.ts => getOptimismNodeRpcUrlIfExists.ts} | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename packages/dappmanager/src/modules/optimism/{getOptimismNodeRpcUrl.ts => getOptimismNodeRpcUrlIfExists.ts} (71%) diff --git a/packages/dappmanager/src/modules/optimism/getOptimismConfig.ts b/packages/dappmanager/src/modules/optimism/getOptimismConfig.ts index 355325844..7452032a1 100644 --- a/packages/dappmanager/src/modules/optimism/getOptimismConfig.ts +++ b/packages/dappmanager/src/modules/optimism/getOptimismConfig.ts @@ -14,7 +14,7 @@ import { getIsUpdated } from "../../calls/fetchDnpRequest.js"; import { fileToGatewayUrl } from "../../utils/distributedFile.js"; -import { getOptimismNodeRpcUrl } from "./getOptimismNodeRpcUrl.js"; +import { getOptimismNodeRpcUrlIfExists } from "./getOptimismNodeRpcUrlIfExists.js"; export async function getOptimismConfig(): Promise { try { @@ -61,7 +61,7 @@ export async function getOptimismConfig(): Promise { throw Error(`Repository ${optimismNode} does not exist`); const pkgData = await getPkgData(releaseFetcher, optimismNode); - const mainnetRpcUrl = getOptimismNodeRpcUrl(); + const mainnetRpcUrl = getOptimismNodeRpcUrlIfExists(); const isRunning = getIsRunning(pkgData, dnpList); resolve({ status: "ok", diff --git a/packages/dappmanager/src/modules/optimism/getOptimismNodeRpcUrl.ts b/packages/dappmanager/src/modules/optimism/getOptimismNodeRpcUrlIfExists.ts similarity index 71% rename from packages/dappmanager/src/modules/optimism/getOptimismNodeRpcUrl.ts rename to packages/dappmanager/src/modules/optimism/getOptimismNodeRpcUrlIfExists.ts index 12ba8ee83..ca07530c3 100644 --- a/packages/dappmanager/src/modules/optimism/getOptimismNodeRpcUrl.ts +++ b/packages/dappmanager/src/modules/optimism/getOptimismNodeRpcUrlIfExists.ts @@ -2,11 +2,11 @@ import { optimismNode } from "@dappnode/types"; import { ComposeFileEditor } from "../compose/editor.js"; import { opNodeRpcUrlEnvName, opNodeServiceName } from "./params.js"; -export function getOptimismNodeRpcUrl(): string { - const userSettings = new ComposeFileEditor( +export function getOptimismNodeRpcUrlIfExists(): string { + const userSettings = ComposeFileEditor.getUserSettingsIfExist( optimismNode, false - ).getUserSettings(); + ); return userSettings.environment ? userSettings.environment[opNodeServiceName][opNodeRpcUrlEnvName] : "";