From f01780ceae6705752bfec526bdc8ec35c61ea4c8 Mon Sep 17 00:00:00 2001 From: Pablo Mendez Date: Tue, 19 Sep 2023 10:23:47 +0200 Subject: [PATCH] update params imports --- .../src/api/middlewares/ethForward/index.ts | 2 +- .../api/middlewares/ethForward/ipfsProxy.ts | 2 +- .../api/middlewares/ethForward/views/index.ts | 2 +- packages/dappmanager/src/api/routes/upload.ts | 2 +- packages/dappmanager/src/api/startTestApi.ts | 2 +- packages/dappmanager/src/calls/backupGet.ts | 2 +- .../dappmanager/src/calls/backupRestore.ts | 2 +- .../src/calls/changeIpfsTimeout.ts | 2 +- packages/dappmanager/src/calls/cleanCache.ts | 2 +- packages/dappmanager/src/calls/copyFileTo.ts | 2 +- .../src/calls/fetchCoreUpdateData.ts | 2 +- .../dappmanager/src/calls/fetchDnpRequest.ts | 2 +- packages/dappmanager/src/calls/httpsPortal.ts | 2 +- packages/dappmanager/src/calls/localProxy.ts | 2 +- packages/dappmanager/src/calls/packageGet.ts | 2 +- .../dappmanager/src/calls/packageRemove.ts | 7 +- .../dappmanager/src/calls/packageRestart.ts | 2 +- .../src/calls/packageRestartVolumes.ts | 12 +- .../src/calls/packageSetPortMappings.ts | 2 +- .../dappmanager/src/calls/packageStartStop.ts | 2 +- .../dappmanager/src/calls/seedPhraseSet.ts | 2 +- packages/dappmanager/src/calls/wifi.ts | 2 +- .../src/daemons/autoUpdates/index.ts | 2 +- .../autoUpdates/sendUpdateNotification.ts | 2 +- .../daemons/autoUpdates/updateMyPackages.ts | 2 +- .../autoUpdates/updateSystemPackages.ts | 2 +- .../src/daemons/diskUsage/index.ts | 2 +- .../dappmanager/src/daemons/dyndns/index.ts | 2 +- .../src/daemons/ethMultiClient/index.ts | 2 +- .../src/daemons/ethicalMetrics/index.ts | 22 +- .../src/daemons/natRenewal/index.ts | 2 +- .../dappmanager/src/daemons/nsupdate/index.ts | 2 +- packages/dappmanager/src/db/dbFactory.ts | 2 +- .../src/db/interceptGlobalEnvOnSet.ts | 2 +- packages/dappmanager/src/db/ipfsClient.ts | 2 +- packages/dappmanager/src/db/releaseKeys.ts | 2 +- packages/dappmanager/src/domains.ts | 2 +- packages/dappmanager/src/index.ts | 2 +- packages/dappmanager/src/initializeDb.ts | 2 +- packages/dappmanager/src/logUserAction.ts | 2 +- .../dappmanager/src/modules/compose/editor.ts | 2 +- .../src/modules/dappGet/aggregate/index.ts | 2 +- .../src/modules/docker/api/network.ts | 22 +- .../src/modules/docker/dockerComposeUp.ts | 2 +- .../modules/docker/list/parseContainerInfo.ts | 2 +- .../src/modules/docker/removeNamedVolume.ts | 2 +- .../src/modules/dyndns/generateKeys.ts | 2 +- .../src/modules/dyndns/updateIp.ts | 2 +- .../src/modules/ethClient/clientStatus.ts | 2 +- .../src/modules/ethClient/ethereumClient.ts | 3 +- .../src/modules/ethClient/ethersProvider.ts | 2 +- .../ethClient/localFallbackVersions.ts | 2 +- .../dappmanager/src/modules/globalEnvs.ts | 2 +- .../src/modules/hostScripts/copyScripts.ts | 2 +- .../src/modules/hostScripts/runScripts.ts | 2 +- .../modules/hostServices/copyHostService.ts | 2 +- .../modules/hostServices/copyHostServices.ts | 2 +- .../src/modules/hostServices/runService.ts | 2 +- .../src/modules/https-portal/index.ts | 2 +- .../utils/connectToPublicNetwork.ts | 2 +- .../https-portal/utils/isRunningHttps.ts | 2 +- .../ensureEth2MigrationRequirements.ts | 2 +- .../modules/installer/orderInstallPackages.ts | 2 +- .../src/modules/installer/restartPatch.ts | 2 +- .../src/modules/installer/rollbackPackages.ts | 2 +- .../src/modules/installer/runPackages.ts | 2 +- .../dappmanager/src/modules/ipfs/utils.ts | 2 +- .../modules/ipfsClient/changeIpfsClient.ts | 2 +- .../src/modules/manifest/manifestToCompose.ts | 3 +- .../migrations/addAliasToRunningContainers.ts | 6 +- .../migrations/migrateUserActionLogs.ts | 2 +- .../modules/migrations/pruneUserActionLogs.ts | 2 +- .../dappmanager/src/modules/nsupdate/utils.ts | 2 +- .../modules/portsTable/performPortsScan.ts | 2 +- .../src/modules/release/getRelease.ts | 2 +- .../src/modules/wireguard/client.ts | 2 +- packages/dappmanager/src/params.ts | 342 ------------------ .../dappmanager/src/utils/autoUpdateHelper.ts | 2 +- .../dappmanager/src/utils/distributedFile.ts | 2 +- .../src/utils/getDappmanagerImage.ts | 2 +- packages/dappmanager/src/utils/getPath.ts | 2 +- .../dappmanager/src/utils/getServerName.ts | 2 +- packages/dappmanager/src/utils/getStaticIp.ts | 2 +- .../dappmanager/src/utils/getVersionData.ts | 2 +- packages/dappmanager/src/utils/seedPhrase.ts | 2 +- packages/dappmanager/src/utils/shell.ts | 2 +- packages/dappmanager/src/utils/sign.ts | 2 +- 87 files changed, 125 insertions(+), 450 deletions(-) delete mode 100644 packages/dappmanager/src/params.ts diff --git a/packages/dappmanager/src/api/middlewares/ethForward/index.ts b/packages/dappmanager/src/api/middlewares/ethForward/index.ts index 182fd9948..288843426 100644 --- a/packages/dappmanager/src/api/middlewares/ethForward/index.ts +++ b/packages/dappmanager/src/api/middlewares/ethForward/index.ts @@ -1,5 +1,5 @@ import express from "express"; -import params from "../../../params.js"; +import { params } from "@dappnode/params"; import { getIpfsProxyHandler, ProxyType } from "./ipfsProxy.js"; import { ResolveDomainWithCache } from "./resolveDomain.js"; diff --git a/packages/dappmanager/src/api/middlewares/ethForward/ipfsProxy.ts b/packages/dappmanager/src/api/middlewares/ethForward/ipfsProxy.ts index bbbcd7157..8f46d0448 100644 --- a/packages/dappmanager/src/api/middlewares/ethForward/ipfsProxy.ts +++ b/packages/dappmanager/src/api/middlewares/ethForward/ipfsProxy.ts @@ -1,7 +1,7 @@ import http from "http"; import httpProxy from "http-proxy"; import express from "express"; -import params from "../../../params.js"; +import { params } from "@dappnode/params"; import { EthProviderError } from "../../../modules/ethClient/index.js"; import { ipfs } from "../../../modules/ipfs/index.js"; import { urlJoin } from "../../../utils/url.js"; diff --git a/packages/dappmanager/src/api/middlewares/ethForward/views/index.ts b/packages/dappmanager/src/api/middlewares/ethForward/views/index.ts index c23f9fe68..923498b70 100644 --- a/packages/dappmanager/src/api/middlewares/ethForward/views/index.ts +++ b/packages/dappmanager/src/api/middlewares/ethForward/views/index.ts @@ -1,6 +1,6 @@ import { base } from "./base.js"; import { NotFoundError } from "../types.js"; -import params from "../../../../params.js"; +import { params } from "@dappnode/params"; const adminUiUrl = `http://my.dappnode/`; const adminUiInstallUrl = `${adminUiUrl}/installer`; diff --git a/packages/dappmanager/src/api/routes/upload.ts b/packages/dappmanager/src/api/routes/upload.ts index 4476cf764..b1ac4f763 100644 --- a/packages/dappmanager/src/api/routes/upload.ts +++ b/packages/dappmanager/src/api/routes/upload.ts @@ -1,7 +1,7 @@ import fs from "fs"; import path from "path"; import crypto from "crypto"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import * as db from "../../db/index.js"; import { logs } from "../../logs.js"; import { wrapHandler } from "../utils.js"; diff --git a/packages/dappmanager/src/api/startTestApi.ts b/packages/dappmanager/src/api/startTestApi.ts index cb133c524..c5c8b6555 100644 --- a/packages/dappmanager/src/api/startTestApi.ts +++ b/packages/dappmanager/src/api/startTestApi.ts @@ -2,7 +2,7 @@ import * as api from "../calls/index.js"; import http from "http"; import express from "express"; import bodyParser from "body-parser"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../logs.js"; export function startTestApi(): http.Server { diff --git a/packages/dappmanager/src/calls/backupGet.ts b/packages/dappmanager/src/calls/backupGet.ts index 410ee144c..bb30e5957 100644 --- a/packages/dappmanager/src/calls/backupGet.ts +++ b/packages/dappmanager/src/calls/backupGet.ts @@ -3,7 +3,7 @@ import crypto from "crypto"; import path from "path"; import { logs } from "../logs.js"; import * as db from "../db/index.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; // Modules import { listPackage } from "../modules/docker/list/index.js"; // Utils diff --git a/packages/dappmanager/src/calls/backupRestore.ts b/packages/dappmanager/src/calls/backupRestore.ts index 3685ec197..f15fee2a6 100644 --- a/packages/dappmanager/src/calls/backupRestore.ts +++ b/packages/dappmanager/src/calls/backupRestore.ts @@ -1,7 +1,7 @@ import path from "path"; import fs from "fs"; import * as db from "../db/index.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../logs.js"; import { listPackage } from "../modules/docker/list/index.js"; import { packageRestart } from "./packageRestart.js"; diff --git a/packages/dappmanager/src/calls/changeIpfsTimeout.ts b/packages/dappmanager/src/calls/changeIpfsTimeout.ts index 933a233a3..e79f5e4b2 100644 --- a/packages/dappmanager/src/calls/changeIpfsTimeout.ts +++ b/packages/dappmanager/src/calls/changeIpfsTimeout.ts @@ -1,4 +1,4 @@ -import params from "../params.js"; +import { params } from "@dappnode/params"; /** * Used to test different IPFS timeout parameters live from the ADMIN UI. diff --git a/packages/dappmanager/src/calls/cleanCache.ts b/packages/dappmanager/src/calls/cleanCache.ts index 38d3e6b4c..9f3ddfcb2 100644 --- a/packages/dappmanager/src/calls/cleanCache.ts +++ b/packages/dappmanager/src/calls/cleanCache.ts @@ -1,4 +1,4 @@ -import params from "../params.js"; +import { params } from "@dappnode/params"; import { clearCacheDb } from "../db/index.js"; // Utils import shell from "../utils/shell.js"; diff --git a/packages/dappmanager/src/calls/copyFileTo.ts b/packages/dappmanager/src/calls/copyFileTo.ts index 4e8cbd887..c7e9c980c 100644 --- a/packages/dappmanager/src/calls/copyFileTo.ts +++ b/packages/dappmanager/src/calls/copyFileTo.ts @@ -7,7 +7,7 @@ import { // Utils import shell from "../utils/shell.js"; import dataUriToFile from "../utils/dataUriToFile.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; const tempTransferDir = params.TEMP_TRANSFER_DIR; diff --git a/packages/dappmanager/src/calls/fetchCoreUpdateData.ts b/packages/dappmanager/src/calls/fetchCoreUpdateData.ts index 27108bb28..6eead0d39 100644 --- a/packages/dappmanager/src/calls/fetchCoreUpdateData.ts +++ b/packages/dappmanager/src/calls/fetchCoreUpdateData.ts @@ -1,5 +1,5 @@ import { valid, satisfies } from "semver"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { CoreUpdateData, PackageRelease } from "@dappnode/common"; import { ReleaseFetcher } from "../modules/release/index.js"; import { listPackages } from "../modules/docker/list/index.js"; diff --git a/packages/dappmanager/src/calls/fetchDnpRequest.ts b/packages/dappmanager/src/calls/fetchDnpRequest.ts index f5d533552..5f31e10e6 100644 --- a/packages/dappmanager/src/calls/fetchDnpRequest.ts +++ b/packages/dappmanager/src/calls/fetchDnpRequest.ts @@ -2,7 +2,7 @@ import { mapValues, omit } from "lodash-es"; import { valid, gt } from "semver"; import { Manifest, SetupWizardField } from "@dappnode/types"; import { listPackages } from "../modules/docker/list/index.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import shouldUpdate from "../modules/dappGet/utils/shouldUpdate.js"; import deepmerge from "deepmerge"; import { fileToGatewayUrl } from "../utils/distributedFile.js"; diff --git a/packages/dappmanager/src/calls/httpsPortal.ts b/packages/dappmanager/src/calls/httpsPortal.ts index f72d1295b..3c3265707 100644 --- a/packages/dappmanager/src/calls/httpsPortal.ts +++ b/packages/dappmanager/src/calls/httpsPortal.ts @@ -1,4 +1,4 @@ -import params from "../params.js"; +import { params } from "@dappnode/params"; import { HttpsPortalMapping, ExposableServiceMapping } from "@dappnode/common"; import { HttpsPortal, diff --git a/packages/dappmanager/src/calls/localProxy.ts b/packages/dappmanager/src/calls/localProxy.ts index 4000e1cd4..c9affd41b 100644 --- a/packages/dappmanager/src/calls/localProxy.ts +++ b/packages/dappmanager/src/calls/localProxy.ts @@ -4,7 +4,7 @@ import { startAvahiDaemon, getAvahiDaemonStatus } from "../modules/hostScripts/scripts/avahiDaemon.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { AvahiDaemonStatus, LocalProxyingStatus } from "@dappnode/common"; import { packageSetEnvironment } from "./packageSetEnvironment.js"; import { listPackageNoThrow } from "../modules/docker/list/index.js"; diff --git a/packages/dappmanager/src/calls/packageGet.ts b/packages/dappmanager/src/calls/packageGet.ts index 534a53ddc..7bff2b58a 100644 --- a/packages/dappmanager/src/calls/packageGet.ts +++ b/packages/dappmanager/src/calls/packageGet.ts @@ -8,7 +8,7 @@ import { logs } from "../logs.js"; import { ComposeFileEditor } from "../modules/compose/editor.js"; import { getVolumesOwnershipData } from "../modules/docker/volumesData.js"; import { sortPackages } from "./packagesGet.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; /** * Get package detail information diff --git a/packages/dappmanager/src/calls/packageRemove.ts b/packages/dappmanager/src/calls/packageRemove.ts index 5bf724184..4f5e99950 100644 --- a/packages/dappmanager/src/calls/packageRemove.ts +++ b/packages/dappmanager/src/calls/packageRemove.ts @@ -1,6 +1,6 @@ import fs from "fs"; import { eventBus } from "../eventBus.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { dockerComposeDown } from "../modules/docker/compose/index.js"; import { dockerContainerRemove, @@ -15,7 +15,10 @@ import { isRunningHttps } from "../modules/https-portal/utils/isRunningHttps.js" import { httpsPortal } from "./httpsPortal.js"; import * as db from "../db/index.js"; import { mevBoostMainnet, mevBoostPrater, stakerPkgs } from "@dappnode/types"; -import { ethicalMetricsDnpName, unregister } from "../modules/ethicalMetrics/index.js"; +import { + ethicalMetricsDnpName, + unregister +} from "../modules/ethicalMetrics/index.js"; /** * Remove package data: docker down + disk files diff --git a/packages/dappmanager/src/calls/packageRestart.ts b/packages/dappmanager/src/calls/packageRestart.ts index 5eda3c4b2..780cdbbe7 100644 --- a/packages/dappmanager/src/calls/packageRestart.ts +++ b/packages/dappmanager/src/calls/packageRestart.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { eventBus } from "../eventBus.js"; import * as getPath from "../utils/getPath.js"; import { dockerContainerRestart } from "../modules/docker/index.js"; diff --git a/packages/dappmanager/src/calls/packageRestartVolumes.ts b/packages/dappmanager/src/calls/packageRestartVolumes.ts index d4de027aa..95c8ba2ab 100644 --- a/packages/dappmanager/src/calls/packageRestartVolumes.ts +++ b/packages/dappmanager/src/calls/packageRestartVolumes.ts @@ -1,7 +1,7 @@ import fs from "fs"; import { removeNamedVolume } from "../modules/docker/removeNamedVolume.js"; import { eventBus } from "../eventBus.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../logs.js"; import * as getPath from "../utils/getPath.js"; import { @@ -17,7 +17,10 @@ import { packageInstalledHasPid } from "../utils/pid.js"; import { ComposeFileEditor } from "../modules/compose/editor.js"; import { containerNamePrefix, containerCoreNamePrefix } from "@dappnode/types"; import { unregister } from "../modules/ethicalMetrics/unregister.js"; -import { ethicalMetricsDnpName, ethicalMetricsTorServiceVolume } from "../modules/ethicalMetrics/index.js"; +import { + ethicalMetricsDnpName, + ethicalMetricsTorServiceVolume +} from "../modules/ethicalMetrics/index.js"; /** * Removes a package volumes. The re-ups the package @@ -58,7 +61,10 @@ export async function packageRestartVolumes({ } // The Ethical Metrics instance must be unregistered if the tor hidden service volume is removed - if ((dnp.dnpName === ethicalMetricsDnpName && !volumeName) || volumeName === ethicalMetricsTorServiceVolume) { + if ( + (dnp.dnpName === ethicalMetricsDnpName && !volumeName) || + volumeName === ethicalMetricsTorServiceVolume + ) { try { await unregister(); } catch (e) { diff --git a/packages/dappmanager/src/calls/packageSetPortMappings.ts b/packages/dappmanager/src/calls/packageSetPortMappings.ts index 16ded4029..48f25a9c9 100644 --- a/packages/dappmanager/src/calls/packageSetPortMappings.ts +++ b/packages/dappmanager/src/calls/packageSetPortMappings.ts @@ -1,5 +1,5 @@ import { eventBus } from "../eventBus.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { listPackage } from "../modules/docker/list/index.js"; import { ComposeFileEditor } from "../modules/compose/editor.js"; import { PortMapping } from "@dappnode/common"; diff --git a/packages/dappmanager/src/calls/packageStartStop.ts b/packages/dappmanager/src/calls/packageStartStop.ts index c599b78d6..b647eaa22 100644 --- a/packages/dappmanager/src/calls/packageStartStop.ts +++ b/packages/dappmanager/src/calls/packageStartStop.ts @@ -4,7 +4,7 @@ import { dockerContainerStart } from "../modules/docker/index.js"; import { eventBus } from "../eventBus.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { getServicesSharingPid } from "../utils/pid.js"; import { ComposeFileEditor } from "../modules/compose/editor.js"; import { PackageContainer } from "@dappnode/common"; diff --git a/packages/dappmanager/src/calls/seedPhraseSet.ts b/packages/dappmanager/src/calls/seedPhraseSet.ts index 1876c2a83..5b33718a5 100644 --- a/packages/dappmanager/src/calls/seedPhraseSet.ts +++ b/packages/dappmanager/src/calls/seedPhraseSet.ts @@ -2,7 +2,7 @@ import { storePrivateKeyFromSeed } from "../utils/seedPhrase.js"; import { decrypt } from "../utils/publickeyEncryption.js"; import * as db from "../db/index.js"; import { eventBus } from "../eventBus.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; const adminPublicKey = params.ADMIN_NACL_PUBLIC_KEY; diff --git a/packages/dappmanager/src/calls/wifi.ts b/packages/dappmanager/src/calls/wifi.ts index 1fd19091a..63c83e381 100644 --- a/packages/dappmanager/src/calls/wifi.ts +++ b/packages/dappmanager/src/calls/wifi.ts @@ -2,7 +2,7 @@ import { ComposeFileEditor } from "../modules/compose/editor.js"; import { logContainer } from "../modules/docker/api/index.js"; import { listContainer } from "../modules/docker/list/index.js"; import { CurrentWifiCredentials, WifiReport } from "@dappnode/common"; -import params from "../params.js"; +import { params } from "@dappnode/params"; /** * Return wifi report diff --git a/packages/dappmanager/src/daemons/autoUpdates/index.ts b/packages/dappmanager/src/daemons/autoUpdates/index.ts index 0d518d4ff..ab8913154 100644 --- a/packages/dappmanager/src/daemons/autoUpdates/index.ts +++ b/packages/dappmanager/src/daemons/autoUpdates/index.ts @@ -1,4 +1,4 @@ -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { eventBus } from "../../eventBus.js"; import { ReleaseFetcher } from "../../modules/release/index.js"; import { EthProviderError } from "../../modules/ethClient/index.js"; diff --git a/packages/dappmanager/src/daemons/autoUpdates/sendUpdateNotification.ts b/packages/dappmanager/src/daemons/autoUpdates/sendUpdateNotification.ts index 6c772c219..76aa8773a 100644 --- a/packages/dappmanager/src/daemons/autoUpdates/sendUpdateNotification.ts +++ b/packages/dappmanager/src/daemons/autoUpdates/sendUpdateNotification.ts @@ -1,5 +1,5 @@ import { valid, lte } from "semver"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import * as db from "../../db/index.js"; import { eventBus } from "../../eventBus.js"; import { ReleaseFetcher } from "../../modules/release/index.js"; diff --git a/packages/dappmanager/src/daemons/autoUpdates/updateMyPackages.ts b/packages/dappmanager/src/daemons/autoUpdates/updateMyPackages.ts index 7102373df..a7265639f 100644 --- a/packages/dappmanager/src/daemons/autoUpdates/updateMyPackages.ts +++ b/packages/dappmanager/src/daemons/autoUpdates/updateMyPackages.ts @@ -1,5 +1,5 @@ import { valid, lte } from "semver"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { listPackages } from "../../modules/docker/list/index.js"; import { eventBus } from "../../eventBus.js"; import { ReleaseFetcher } from "../../modules/release/index.js"; diff --git a/packages/dappmanager/src/daemons/autoUpdates/updateSystemPackages.ts b/packages/dappmanager/src/daemons/autoUpdates/updateSystemPackages.ts index 57340bf74..54106ed93 100644 --- a/packages/dappmanager/src/daemons/autoUpdates/updateSystemPackages.ts +++ b/packages/dappmanager/src/daemons/autoUpdates/updateSystemPackages.ts @@ -1,5 +1,5 @@ import { eventBus } from "../../eventBus.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { isUpdateDelayCompleted, flagCompletedUpdate, diff --git a/packages/dappmanager/src/daemons/diskUsage/index.ts b/packages/dappmanager/src/daemons/diskUsage/index.ts index 41afb49fc..416679838 100644 --- a/packages/dappmanager/src/daemons/diskUsage/index.ts +++ b/packages/dappmanager/src/daemons/diskUsage/index.ts @@ -1,6 +1,6 @@ import * as db from "../../db/index.js"; import shellExec from "../../utils/shell.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { eventBus } from "../../eventBus.js"; import { logs } from "../../logs.js"; import { runAtMostEvery } from "../../utils/asyncFlows.js"; diff --git a/packages/dappmanager/src/daemons/dyndns/index.ts b/packages/dappmanager/src/daemons/dyndns/index.ts index 9bbe7071c..25127be62 100644 --- a/packages/dappmanager/src/daemons/dyndns/index.ts +++ b/packages/dappmanager/src/daemons/dyndns/index.ts @@ -1,5 +1,5 @@ import { eventBus } from "../../eventBus.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import * as db from "../../db/index.js"; import updateIp from "../../modules/dyndns/updateIp.js"; import lookup from "../../utils/lookup.js"; diff --git a/packages/dappmanager/src/daemons/ethMultiClient/index.ts b/packages/dappmanager/src/daemons/ethMultiClient/index.ts index f10a42869..567dbb655 100644 --- a/packages/dappmanager/src/daemons/ethMultiClient/index.ts +++ b/packages/dappmanager/src/daemons/ethMultiClient/index.ts @@ -1,6 +1,6 @@ import * as db from "../../db/index.js"; import { eventBus } from "../../eventBus.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { packageInstall } from "../../calls/index.js"; import { listPackageNoThrow } from "../../modules/docker/list/index.js"; import { runOnlyOneSequentially } from "../../utils/asyncFlows.js"; diff --git a/packages/dappmanager/src/daemons/ethicalMetrics/index.ts b/packages/dappmanager/src/daemons/ethicalMetrics/index.ts index 857b3a403..25cbda807 100644 --- a/packages/dappmanager/src/daemons/ethicalMetrics/index.ts +++ b/packages/dappmanager/src/daemons/ethicalMetrics/index.ts @@ -1,5 +1,5 @@ import { eventBus } from "../../eventBus.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { runOnlyOneSequentially } from "../../utils/asyncFlows.js"; import { runAtMostEvery } from "../../utils/asyncFlows.js"; import { logs } from "../../logs.js"; @@ -7,21 +7,24 @@ import { checkEthicalMetricsStatus } from "./checkEthicalMetricsStatus.js"; /** * Randomize an interval - * + * * Example: * getRandomizedInterval(50, 10) // 50 +/- 10 = [40, 60] - * + * * @param baseInterval - * @param variation - * @returns + * @param variation + * @returns */ -function getRandomizedInterval(baseInterval: number, variation: number): number { +function getRandomizedInterval( + baseInterval: number, + variation: number +): number { const randomAdjustment = Math.round((Math.random() * 2 - 1) * variation); // Random integer between -variation and +variation return baseInterval + randomAdjustment; } /** - * Run the Ethical metrics daemon. + * Run the Ethical metrics daemon. * It will check that DMS, Exporter and Ethical metrics are installed and running if Ethical metrics is enabled */ export function startEthicalMetricsDaemon(signal: AbortSignal): void { @@ -38,7 +41,10 @@ export function startEthicalMetricsDaemon(signal: AbortSignal): void { runAtMostEvery( async () => runEthicalMetricsTaskMemo(), - getRandomizedInterval(params.ETH_METRICS_DAEMON_INTERVAL, params.ETH_METRICS_DAEMON_INTERVAL_VARIATION), + getRandomizedInterval( + params.ETH_METRICS_DAEMON_INTERVAL, + params.ETH_METRICS_DAEMON_INTERVAL_VARIATION + ), signal ); } diff --git a/packages/dappmanager/src/daemons/natRenewal/index.ts b/packages/dappmanager/src/daemons/natRenewal/index.ts index 566b38d56..d292e2956 100644 --- a/packages/dappmanager/src/daemons/natRenewal/index.ts +++ b/packages/dappmanager/src/daemons/natRenewal/index.ts @@ -1,6 +1,6 @@ import * as upnpc from "../../modules/upnpc/index.js"; import { eventBus } from "../../eventBus.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import * as db from "../../db/index.js"; import getPortsToOpen from "./getPortsToOpen.js"; import getLocalIp from "../../utils/getLocalIp.js"; diff --git a/packages/dappmanager/src/daemons/nsupdate/index.ts b/packages/dappmanager/src/daemons/nsupdate/index.ts index d0dc008a9..4b89d6b95 100644 --- a/packages/dappmanager/src/daemons/nsupdate/index.ts +++ b/packages/dappmanager/src/daemons/nsupdate/index.ts @@ -1,7 +1,7 @@ import retry from "async-retry"; import { eventBus } from "../../eventBus.js"; import * as db from "../../db/index.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { listContainers } from "../../modules/docker/list/index.js"; import { getNsupdateTxts, execNsupdate } from "../../modules/nsupdate/index.js"; import { runAtMostEveryIntervals } from "../../utils/asyncFlows.js"; diff --git a/packages/dappmanager/src/db/dbFactory.ts b/packages/dappmanager/src/db/dbFactory.ts index 7d957575f..f3d8ebf0f 100644 --- a/packages/dappmanager/src/db/dbFactory.ts +++ b/packages/dappmanager/src/db/dbFactory.ts @@ -1,7 +1,7 @@ import * as validate from "../utils/validate.js"; import { logs } from "../logs.js"; import { JsonFileDb } from "@dappnode/utils"; -import params from "../params.js"; +import { params } from "@dappnode/params"; /** * Stores critical data for this DAppNode, such as the DynDNS identity diff --git a/packages/dappmanager/src/db/interceptGlobalEnvOnSet.ts b/packages/dappmanager/src/db/interceptGlobalEnvOnSet.ts index 088dedc57..e07901f4c 100644 --- a/packages/dappmanager/src/db/interceptGlobalEnvOnSet.ts +++ b/packages/dappmanager/src/db/interceptGlobalEnvOnSet.ts @@ -3,7 +3,7 @@ import { updatePkgsWithGlobalEnvs, writeGlobalEnvsToEnvFile } from "../modules/globalEnvs.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; /** * Intercept all on set methods when any global env is set. When updating a global env there must be done: diff --git a/packages/dappmanager/src/db/ipfsClient.ts b/packages/dappmanager/src/db/ipfsClient.ts index f0b607fe6..7cc423304 100644 --- a/packages/dappmanager/src/db/ipfsClient.ts +++ b/packages/dappmanager/src/db/ipfsClient.ts @@ -1,6 +1,6 @@ import { dbMain } from "./dbFactory.js"; import { IpfsClientTarget } from "@dappnode/common"; -import params from "../params.js"; +import { params } from "@dappnode/params"; // User chosen properties const IPFS_CLIENT_TARGET = "ipfs-client-target"; diff --git a/packages/dappmanager/src/db/releaseKeys.ts b/packages/dappmanager/src/db/releaseKeys.ts index f2fd018ed..7a961f2c5 100644 --- a/packages/dappmanager/src/db/releaseKeys.ts +++ b/packages/dappmanager/src/db/releaseKeys.ts @@ -1,4 +1,4 @@ -import params from "../params.js"; +import { params } from "@dappnode/params"; import { TrustedReleaseKey } from "@dappnode/common"; import { dbMain } from "./dbFactory.js"; diff --git a/packages/dappmanager/src/domains.ts b/packages/dappmanager/src/domains.ts index 1f485695b..a6e7d3c00 100644 --- a/packages/dappmanager/src/domains.ts +++ b/packages/dappmanager/src/domains.ts @@ -1,4 +1,4 @@ -import params from "./params.js"; +import { params } from "@dappnode/params"; import { getContainerDomain } from "@dappnode/types"; export function stripCharacters(s: string): string { diff --git a/packages/dappmanager/src/index.ts b/packages/dappmanager/src/index.ts index 5186bf021..0bf16a1f9 100644 --- a/packages/dappmanager/src/index.ts +++ b/packages/dappmanager/src/index.ts @@ -11,7 +11,7 @@ import * as calls from "./calls/index.js"; import { routesLogger, subscriptionsLogger } from "./api/logger.js"; import * as routes from "./api/routes/index.js"; import { logs } from "./logs.js"; -import params from "./params.js"; +import { params } from "@dappnode/params"; import { getVpnApiClient } from "./api/vpnApiClient.js"; import { getVersionData, diff --git a/packages/dappmanager/src/initializeDb.ts b/packages/dappmanager/src/initializeDb.ts index e36dcf7d5..5285b2a82 100644 --- a/packages/dappmanager/src/initializeDb.ts +++ b/packages/dappmanager/src/initializeDb.ts @@ -8,7 +8,7 @@ import getStaticIp from "./utils/getStaticIp.js"; import getExternalUpnpIp from "./modules/upnpc/getExternalIp.js"; import { writeGlobalEnvsToEnvFile } from "./modules/globalEnvs.js"; import getPublicIpFromUrls from "./utils/getPublicIpFromUrls.js"; -import params from "./params.js"; +import { params } from "@dappnode/params"; import ping from "./utils/ping.js"; import { pause } from "./utils/asyncFlows.js"; import retry from "async-retry"; diff --git a/packages/dappmanager/src/logUserAction.ts b/packages/dappmanager/src/logUserAction.ts index a4d77621c..3fd8e5a6f 100644 --- a/packages/dappmanager/src/logUserAction.ts +++ b/packages/dappmanager/src/logUserAction.ts @@ -1,5 +1,5 @@ import { eventBus } from "./eventBus.js"; -import params from "./params.js"; +import { params } from "@dappnode/params"; import { UserActionLog } from "@dappnode/common"; import { logSafeObjects } from "./utils/logs.js"; import { JsonFileDb } from "@dappnode/utils"; diff --git a/packages/dappmanager/src/modules/compose/editor.ts b/packages/dappmanager/src/modules/compose/editor.ts index c1437ba20..e892ef516 100644 --- a/packages/dappmanager/src/modules/compose/editor.ts +++ b/packages/dappmanager/src/modules/compose/editor.ts @@ -41,7 +41,7 @@ import { computeGlobalEnvsFromDb, getGlobalEnvsFilePath } from "../globalEnvs.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; export class ComposeServiceEditor { parent: ComposeEditor; diff --git a/packages/dappmanager/src/modules/dappGet/aggregate/index.ts b/packages/dappmanager/src/modules/dappGet/aggregate/index.ts index 07cb2c8be..8b2f093d5 100644 --- a/packages/dappmanager/src/modules/dappGet/aggregate/index.ts +++ b/packages/dappmanager/src/modules/dappGet/aggregate/index.ts @@ -1,5 +1,5 @@ import { valid, lt } from "semver"; -import params from "../../../params.js"; +import { params } from "@dappnode/params"; // Internal import { safeSemver } from "../utils/safeSemver.js"; import aggregateDependencies from "./aggregateDependencies.js"; diff --git a/packages/dappmanager/src/modules/docker/api/network.ts b/packages/dappmanager/src/modules/docker/api/network.ts index d23fb1a9c..7019ca806 100644 --- a/packages/dappmanager/src/modules/docker/api/network.ts +++ b/packages/dappmanager/src/modules/docker/api/network.ts @@ -1,7 +1,7 @@ import Dockerode from "dockerode"; import { docker } from "./docker.js"; -import {dockerContainerInspect } from "../index.js" -import params from "../../../params.js"; +import { dockerContainerInspect } from "../index.js"; +import { params } from "@dappnode/params"; /** * Connect a container to a network @@ -64,13 +64,13 @@ export async function dockerListNetworks(): Promise< return await docker.listNetworks(); } - /** Get endpoint config for DNP_PRIVATE_NETWORK_NAME */ +/** Get endpoint config for DNP_PRIVATE_NETWORK_NAME */ export async function getDnCoreNetworkContainerConfig( - containerName: string - ): Promise { - const inspectInfo = await dockerContainerInspect(containerName); - return ( - inspectInfo.NetworkSettings.Networks[params.DNP_PRIVATE_NETWORK_NAME] ?? - null - ); - } \ No newline at end of file + containerName: string +): Promise { + const inspectInfo = await dockerContainerInspect(containerName); + return ( + inspectInfo.NetworkSettings.Networks[params.DNP_PRIVATE_NETWORK_NAME] ?? + null + ); +} diff --git a/packages/dappmanager/src/modules/docker/dockerComposeUp.ts b/packages/dappmanager/src/modules/docker/dockerComposeUp.ts index 92c7f9abf..c1a787d8a 100644 --- a/packages/dappmanager/src/modules/docker/dockerComposeUp.ts +++ b/packages/dappmanager/src/modules/docker/dockerComposeUp.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import * as getPath from "../../utils/getPath.js"; import { restartDappmanagerPatch } from "../installer/restartPatch.js"; import { ComposeFileEditor } from "../compose/editor.js"; diff --git a/packages/dappmanager/src/modules/docker/list/parseContainerInfo.ts b/packages/dappmanager/src/modules/docker/list/parseContainerInfo.ts index 8e52b947d..bc8456fd6 100644 --- a/packages/dappmanager/src/modules/docker/list/parseContainerInfo.ts +++ b/packages/dappmanager/src/modules/docker/list/parseContainerInfo.ts @@ -1,5 +1,5 @@ import { ContainerInfo } from "dockerode"; -import params from "../../../params.js"; +import { params } from "@dappnode/params"; import { PackageContainer, VolumeMapping, diff --git a/packages/dappmanager/src/modules/docker/removeNamedVolume.ts b/packages/dappmanager/src/modules/docker/removeNamedVolume.ts index 0e1ba51fc..32fbd54b6 100644 --- a/packages/dappmanager/src/modules/docker/removeNamedVolume.ts +++ b/packages/dappmanager/src/modules/docker/removeNamedVolume.ts @@ -1,6 +1,6 @@ import { dockerVolumeRemove, dockerVolumeInspect } from "./api/index.js"; import { shellHost } from "../../utils/shell.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../../logs.js"; /** diff --git a/packages/dappmanager/src/modules/dyndns/generateKeys.ts b/packages/dappmanager/src/modules/dyndns/generateKeys.ts index 054bb62a9..c70f16e6b 100644 --- a/packages/dappmanager/src/modules/dyndns/generateKeys.ts +++ b/packages/dappmanager/src/modules/dyndns/generateKeys.ts @@ -1,5 +1,5 @@ import { ethers } from "ethers"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import * as db from "../../db/index.js"; import { logs } from "../../logs.js"; diff --git a/packages/dappmanager/src/modules/dyndns/updateIp.ts b/packages/dappmanager/src/modules/dyndns/updateIp.ts index 29ad54024..de5dbe28b 100644 --- a/packages/dappmanager/src/modules/dyndns/updateIp.ts +++ b/packages/dappmanager/src/modules/dyndns/updateIp.ts @@ -1,5 +1,5 @@ import { ethers } from "ethers"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import fetch from "node-fetch"; import * as db from "../../db/index.js"; import { logs } from "../../logs.js"; diff --git a/packages/dappmanager/src/modules/ethClient/clientStatus.ts b/packages/dappmanager/src/modules/ethClient/clientStatus.ts index 1d5516857..a62a9f9dc 100644 --- a/packages/dappmanager/src/modules/ethClient/clientStatus.ts +++ b/packages/dappmanager/src/modules/ethClient/clientStatus.ts @@ -7,7 +7,7 @@ import { getEthExecClientApiUrl, getEthConsClientApiUrl } from "./apiUrl.js"; import { parseEthersBlock, parseEthersSyncing } from "../../utils/ethers.js"; import { logs } from "../../logs.js"; import fetch from "node-fetch"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { ExecutionClientMainnet, ConsensusClientMainnet, diff --git a/packages/dappmanager/src/modules/ethClient/ethereumClient.ts b/packages/dappmanager/src/modules/ethClient/ethereumClient.ts index 334bb4712..0926f1479 100644 --- a/packages/dappmanager/src/modules/ethClient/ethereumClient.ts +++ b/packages/dappmanager/src/modules/ethClient/ethereumClient.ts @@ -9,7 +9,7 @@ import { packageInstall } from "../../calls/packageInstall.js"; import { packageRemove } from "../../calls/packageRemove.js"; import { ComposeFileEditor } from "../compose/editor.js"; import { parseServiceNetworks } from "../compose/networks.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { dockerComposeUpPackage, dockerNetworkConnect, @@ -253,7 +253,6 @@ export class EthereumClient { // Utils // TODO: put private in the methods and find a way to test them - removeFullnodeAliasFromCompose( ethClientDnpName: string, ethClientServiceName: string diff --git a/packages/dappmanager/src/modules/ethClient/ethersProvider.ts b/packages/dappmanager/src/modules/ethClient/ethersProvider.ts index 69995e12c..2cb1c4b1d 100644 --- a/packages/dappmanager/src/modules/ethClient/ethersProvider.ts +++ b/packages/dappmanager/src/modules/ethClient/ethersProvider.ts @@ -1,6 +1,6 @@ import { ethers } from "ethers"; import * as db from "../../db/index.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { getMultiClientStatus } from "./clientStatus.js"; import { EthClientStatusError } from "@dappnode/common"; import { emitSyncedNotification } from "./syncedNotification.js"; diff --git a/packages/dappmanager/src/modules/ethClient/localFallbackVersions.ts b/packages/dappmanager/src/modules/ethClient/localFallbackVersions.ts index 32f4612eb..280094486 100644 --- a/packages/dappmanager/src/modules/ethClient/localFallbackVersions.ts +++ b/packages/dappmanager/src/modules/ethClient/localFallbackVersions.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { isNotFoundError } from "../../utils/node.js"; /** diff --git a/packages/dappmanager/src/modules/globalEnvs.ts b/packages/dappmanager/src/modules/globalEnvs.ts index c3503ab69..f78fcc43c 100644 --- a/packages/dappmanager/src/modules/globalEnvs.ts +++ b/packages/dappmanager/src/modules/globalEnvs.ts @@ -1,7 +1,7 @@ import fs from "fs"; import { mapKeys } from "lodash-es"; import * as db from "../db/index.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { stringifyEnvironment } from "../modules/compose/index.js"; import { PackageEnvs } from "@dappnode/types"; import { packageSetEnvironment } from "../calls/packageSetEnvironment.js"; diff --git a/packages/dappmanager/src/modules/hostScripts/copyScripts.ts b/packages/dappmanager/src/modules/hostScripts/copyScripts.ts index 665295442..8c3b7a040 100644 --- a/packages/dappmanager/src/modules/hostScripts/copyScripts.ts +++ b/packages/dappmanager/src/modules/hostScripts/copyScripts.ts @@ -1,7 +1,7 @@ import fs from "fs"; import path from "path"; import crypto from "crypto"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../../logs.js"; const hostScriptsDir = params.HOST_SCRIPTS_DIR; diff --git a/packages/dappmanager/src/modules/hostScripts/runScripts.ts b/packages/dappmanager/src/modules/hostScripts/runScripts.ts index ebcefa2a0..b27b64ba8 100644 --- a/packages/dappmanager/src/modules/hostScripts/runScripts.ts +++ b/packages/dappmanager/src/modules/hostScripts/runScripts.ts @@ -1,7 +1,7 @@ import fs from "fs"; import path from "path"; import { shellHost } from "../../utils/shell.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; const hostScriptsDirFromHost = params.HOST_SCRIPTS_DIR_FROM_HOST; const hostScriptsDir = params.HOST_SCRIPTS_DIR; diff --git a/packages/dappmanager/src/modules/hostServices/copyHostService.ts b/packages/dappmanager/src/modules/hostServices/copyHostService.ts index ff93d5a97..a4093074a 100644 --- a/packages/dappmanager/src/modules/hostServices/copyHostService.ts +++ b/packages/dappmanager/src/modules/hostServices/copyHostService.ts @@ -1,5 +1,5 @@ import path from "path"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { shellHost } from "../../utils/shell.js"; const hostSystemdDir = params.HOST_SYSTEMD_DIR_FROM_HOST; diff --git a/packages/dappmanager/src/modules/hostServices/copyHostServices.ts b/packages/dappmanager/src/modules/hostServices/copyHostServices.ts index 8d638290d..b46aa9a6c 100644 --- a/packages/dappmanager/src/modules/hostServices/copyHostServices.ts +++ b/packages/dappmanager/src/modules/hostServices/copyHostServices.ts @@ -1,6 +1,6 @@ import fs from "fs"; import path from "path"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../../logs.js"; import { sha256File } from "../hostScripts/index.js"; diff --git a/packages/dappmanager/src/modules/hostServices/runService.ts b/packages/dappmanager/src/modules/hostServices/runService.ts index 0d8ce35b1..5780ed600 100644 --- a/packages/dappmanager/src/modules/hostServices/runService.ts +++ b/packages/dappmanager/src/modules/hostServices/runService.ts @@ -1,6 +1,6 @@ import path from "path"; import fs from "fs"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { shellHost } from "../../utils/shell.js"; import { copyHostService } from "./copyHostService.js"; import { reloadServices } from "./reloadServices.js"; diff --git a/packages/dappmanager/src/modules/https-portal/index.ts b/packages/dappmanager/src/modules/https-portal/index.ts index 2a05ea94e..e83132e3e 100644 --- a/packages/dappmanager/src/modules/https-portal/index.ts +++ b/packages/dappmanager/src/modules/https-portal/index.ts @@ -5,7 +5,7 @@ import { dockerNetworkDisconnect } from "../docker/index.js"; import { listContainers } from "../docker/list/index.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { getExternalNetworkAlias } from "../../domains.js"; import { PackageContainer, HttpsPortalMapping } from "@dappnode/common"; import { HttpsPortalApiClient } from "./apiClient.js"; diff --git a/packages/dappmanager/src/modules/https-portal/utils/connectToPublicNetwork.ts b/packages/dappmanager/src/modules/https-portal/utils/connectToPublicNetwork.ts index 518b38102..d748ce993 100644 --- a/packages/dappmanager/src/modules/https-portal/utils/connectToPublicNetwork.ts +++ b/packages/dappmanager/src/modules/https-portal/utils/connectToPublicNetwork.ts @@ -1,7 +1,7 @@ import { httpsPortal } from "../../../calls/index.js"; import { InstallPackageData } from "@dappnode/common"; import { getExternalNetworkAlias } from "../../../domains.js"; -import params from "../../../params.js"; +import { params } from "@dappnode/params"; import { dockerListNetworks, dockerCreateNetwork, diff --git a/packages/dappmanager/src/modules/https-portal/utils/isRunningHttps.ts b/packages/dappmanager/src/modules/https-portal/utils/isRunningHttps.ts index 7a23f9163..0dae52d2e 100644 --- a/packages/dappmanager/src/modules/https-portal/utils/isRunningHttps.ts +++ b/packages/dappmanager/src/modules/https-portal/utils/isRunningHttps.ts @@ -1,4 +1,4 @@ -import params from "../../../params.js"; +import { params } from "@dappnode/params"; import { listPackageNoThrow } from "../../docker/list/listPackages.js"; /** diff --git a/packages/dappmanager/src/modules/installer/ensureEth2MigrationRequirements.ts b/packages/dappmanager/src/modules/installer/ensureEth2MigrationRequirements.ts index 57ec39661..fb11b3fa7 100644 --- a/packages/dappmanager/src/modules/installer/ensureEth2MigrationRequirements.ts +++ b/packages/dappmanager/src/modules/installer/ensureEth2MigrationRequirements.ts @@ -1,6 +1,6 @@ import { InstallPackageData } from "@dappnode/common"; import { lt, lte, valid, gt } from "semver"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { listPackageNoThrow } from "../docker/list/index.js"; interface PrysmLegacySpec { diff --git a/packages/dappmanager/src/modules/installer/orderInstallPackages.ts b/packages/dappmanager/src/modules/installer/orderInstallPackages.ts index f38480a3e..5a8bdc5d3 100644 --- a/packages/dappmanager/src/modules/installer/orderInstallPackages.ts +++ b/packages/dappmanager/src/modules/installer/orderInstallPackages.ts @@ -1,4 +1,4 @@ -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { InstallPackageData } from "@dappnode/common"; const dappmanager = params.dappmanagerDnpName; diff --git a/packages/dappmanager/src/modules/installer/restartPatch.ts b/packages/dappmanager/src/modules/installer/restartPatch.ts index 395a240e7..fa7899c52 100644 --- a/packages/dappmanager/src/modules/installer/restartPatch.ts +++ b/packages/dappmanager/src/modules/installer/restartPatch.ts @@ -5,7 +5,7 @@ import * as validate from "../../utils/validate.js"; import * as db from "../../db/index.js"; import shell from "../../utils/shell.js"; import { pause } from "../../utils/asyncFlows.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../../logs.js"; import Dockerode from "dockerode"; import { diff --git a/packages/dappmanager/src/modules/installer/rollbackPackages.ts b/packages/dappmanager/src/modules/installer/rollbackPackages.ts index 0305f8f97..44b74c409 100644 --- a/packages/dappmanager/src/modules/installer/rollbackPackages.ts +++ b/packages/dappmanager/src/modules/installer/rollbackPackages.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { Log } from "../../utils/logUi.js"; import { InstallPackageDataPaths } from "@dappnode/common"; import { logs } from "../../logs.js"; diff --git a/packages/dappmanager/src/modules/installer/runPackages.ts b/packages/dappmanager/src/modules/installer/runPackages.ts index 0c7ab2a65..d3c405cf4 100644 --- a/packages/dappmanager/src/modules/installer/runPackages.ts +++ b/packages/dappmanager/src/modules/installer/runPackages.ts @@ -1,5 +1,5 @@ import path from "path"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { dockerComposeUp } from "../docker/compose/index.js"; import { restartDappmanagerPatch } from "./restartPatch.js"; import { Log } from "../../utils/logUi.js"; diff --git a/packages/dappmanager/src/modules/ipfs/utils.ts b/packages/dappmanager/src/modules/ipfs/utils.ts index c399bed3c..a73e4424e 100644 --- a/packages/dappmanager/src/modules/ipfs/utils.ts +++ b/packages/dappmanager/src/modules/ipfs/utils.ts @@ -1,7 +1,7 @@ import { IPFSEntry, IPFSPath } from "./types.js"; import { IpfsFileResult } from "../../types.js"; import * as db from "../../db/index.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { IpfsClientTarget } from "@dappnode/common"; /** diff --git a/packages/dappmanager/src/modules/ipfsClient/changeIpfsClient.ts b/packages/dappmanager/src/modules/ipfsClient/changeIpfsClient.ts index 5c40cdb6c..17483c6c2 100644 --- a/packages/dappmanager/src/modules/ipfsClient/changeIpfsClient.ts +++ b/packages/dappmanager/src/modules/ipfsClient/changeIpfsClient.ts @@ -1,4 +1,4 @@ -import params from "../../params.js"; +import { params } from "@dappnode/params"; import * as db from "../../db/index.js"; import { packageRemove, diff --git a/packages/dappmanager/src/modules/manifest/manifestToCompose.ts b/packages/dappmanager/src/modules/manifest/manifestToCompose.ts index df99ac5b9..6a4059ab9 100644 --- a/packages/dappmanager/src/modules/manifest/manifestToCompose.ts +++ b/packages/dappmanager/src/modules/manifest/manifestToCompose.ts @@ -1,7 +1,8 @@ import { pick } from "lodash-es"; import { parseVolumeMappings } from "../compose/volumes.js"; import { parseEnvironment } from "../compose/environment.js"; -import params, { getContainerName } from "../../params.js"; +import { getContainerName } from "@dappnode/utils"; +import { params } from "@dappnode/params"; import { ManifestWithImage } from "../../types.js"; import { Compose, ComposeVolumes, getImageTag } from "@dappnode/types"; import { getIsCore } from "./getIsCore.js"; diff --git a/packages/dappmanager/src/modules/migrations/addAliasToRunningContainers.ts b/packages/dappmanager/src/modules/migrations/addAliasToRunningContainers.ts index 2c1b95947..040c5cbb8 100644 --- a/packages/dappmanager/src/modules/migrations/addAliasToRunningContainers.ts +++ b/packages/dappmanager/src/modules/migrations/addAliasToRunningContainers.ts @@ -4,7 +4,7 @@ import { uniq } from "lodash-es"; import { PackageContainer } from "@dappnode/common"; import { getPrivateNetworkAlias } from "../../domains.js"; import { logs } from "../../logs.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { parseComposeSemver } from "../../utils/sanitizeVersion.js"; import shell from "../../utils/shell.js"; import { ComposeFileEditor } from "../compose/editor.js"; @@ -38,7 +38,9 @@ export async function addAliasToRunningContainers(): Promise { // So this function must be before the check hasAlias() migrateCoreNetworkAndAliasInCompose(container, alias); - const currentEndpointConfig = await getDnCoreNetworkContainerConfig(containerName); + const currentEndpointConfig = await getDnCoreNetworkContainerConfig( + containerName + ); if (hasAlias(currentEndpointConfig, alias)) continue; const endpointConfig: Partial = { ...currentEndpointConfig, diff --git a/packages/dappmanager/src/modules/migrations/migrateUserActionLogs.ts b/packages/dappmanager/src/modules/migrations/migrateUserActionLogs.ts index 86c326d20..d43604c96 100644 --- a/packages/dappmanager/src/modules/migrations/migrateUserActionLogs.ts +++ b/packages/dappmanager/src/modules/migrations/migrateUserActionLogs.ts @@ -2,7 +2,7 @@ import { orderBy } from "lodash-es"; import { logs } from "../../logs.js"; import { UserActionLog } from "@dappnode/common"; import { isNotFoundError } from "../../utils/node.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import fs from "fs"; import { get, set } from "../../logUserAction.js"; diff --git a/packages/dappmanager/src/modules/migrations/pruneUserActionLogs.ts b/packages/dappmanager/src/modules/migrations/pruneUserActionLogs.ts index 23af29199..8cd51c42d 100644 --- a/packages/dappmanager/src/modules/migrations/pruneUserActionLogs.ts +++ b/packages/dappmanager/src/modules/migrations/pruneUserActionLogs.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; /** * Prune the userActionLogs.json file if the current size diff --git a/packages/dappmanager/src/modules/nsupdate/utils.ts b/packages/dappmanager/src/modules/nsupdate/utils.ts index 5c2798004..e011a5937 100644 --- a/packages/dappmanager/src/modules/nsupdate/utils.ts +++ b/packages/dappmanager/src/modules/nsupdate/utils.ts @@ -1,6 +1,6 @@ import { isEmpty } from "lodash-es"; import { PackageContainer } from "@dappnode/common"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { getPrivateNetworkAlias, stripCharacters, diff --git a/packages/dappmanager/src/modules/portsTable/performPortsScan.ts b/packages/dappmanager/src/modules/portsTable/performPortsScan.ts index 687f93178..90adfb4ba 100644 --- a/packages/dappmanager/src/modules/portsTable/performPortsScan.ts +++ b/packages/dappmanager/src/modules/portsTable/performPortsScan.ts @@ -1,5 +1,5 @@ import fetch from "node-fetch"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import Ajv from "ajv"; import { PackagePort } from "@dappnode/common"; import { logs } from "../../logs.js"; diff --git a/packages/dappmanager/src/modules/release/getRelease.ts b/packages/dappmanager/src/modules/release/getRelease.ts index 9b0bfef33..b9ca0d5db 100644 --- a/packages/dappmanager/src/modules/release/getRelease.ts +++ b/packages/dappmanager/src/modules/release/getRelease.ts @@ -12,7 +12,7 @@ import { sanitizeDependencies } from "../dappGet/utils/sanitizeDependencies.js"; import { parseTimeoutSeconds } from "../../utils/timeout.js"; import { ReleaseDownloadedContents } from "./types.js"; import { getReleaseSignatureStatus } from "./releaseSignature.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; /** * Should resolve a name/version into the manifest and all relevant hashes diff --git a/packages/dappmanager/src/modules/wireguard/client.ts b/packages/dappmanager/src/modules/wireguard/client.ts index 63c5bddf0..ee6994320 100644 --- a/packages/dappmanager/src/modules/wireguard/client.ts +++ b/packages/dappmanager/src/modules/wireguard/client.ts @@ -1,6 +1,6 @@ import fetch from "node-fetch"; import { urlJoin } from "../../utils/url.js"; -import params from "../../params.js"; +import { params } from "@dappnode/params"; import { packageSetEnvironment } from "../../calls/packageSetEnvironment.js"; import { ComposeFileEditor } from "../compose/editor.js"; import { WireguardDeviceCredentials } from "@dappnode/common"; diff --git a/packages/dappmanager/src/params.ts b/packages/dappmanager/src/params.ts deleted file mode 100644 index 1671239c4..000000000 --- a/packages/dappmanager/src/params.ts +++ /dev/null @@ -1,342 +0,0 @@ -import path from "path"; - -const devMode = process.env.LOG_LEVEL === "DEV_MODE"; - -const MINUTE = 60 * 1000; // miliseconds -const HOUR = 60 * MINUTE; -const DAY = 24 * HOUR; - -/** - * DAPPMANAGER Parameters. This parameters are modified on execution for testing - */ - -/** - * Main persistent folders, linked with docker volumes - * - No need to prefix or sufix with slashes, path.join() is used in the whole app - */ -let DNCORE_DIR = "/usr/src/app/DNCORE"; // Bind volume -let REPO_DIR = "/usr/src/app/dnp_repo"; // Named volume -const GLOBAL_ENVS_FILE_NAME = "dnp.dappnode.global.env"; -const HOST_HOME = "/usr/src/dappnode"; - -if (process.env.TEST) { - DNCORE_DIR = "./DNCORE"; - REPO_DIR = "./dnp_repo"; -} - -/** Absolute global ENVs .env file from DAPPMANAGER containers */ -const GLOBAL_ENVS_PATH = path.join(DNCORE_DIR, GLOBAL_ENVS_FILE_NAME); - -const params = { - // File paths - REPO_DIR, - DNCORE_DIR, - HOST_HOME, - USER_ACTION_LOGS_DB_PATH: path.join(DNCORE_DIR, "userActionLogs.json"), - // Legacy userActionLogs wiston .log file, migrated to USER_ACTION_LOGS_DB_PATH - userActionLogsFilename: path.join(DNCORE_DIR, "userActionLogs.log"), - // Static files serve - avatarStaticDir: path.join(REPO_DIR, "avatars"), - // lowdb requires an absolute path - DB_MAIN_PATH: path.resolve(DNCORE_DIR, "maindb.json"), - DB_CACHE_PATH: path.resolve(DNCORE_DIR, "dappmanagerdb.json"), - - // File with sole purpose of handling admin password hash. Must be deletable - ADMIN_RECOVERY_FILE: path.join(DNCORE_DIR, "admin-recovery-token.txt"), - ADMIN_PASSWORDS_JSON_FILE: path.join(DNCORE_DIR, "admin-passwords.json"), - ADMIN_STATUS_JSON_FILE: path.join(DNCORE_DIR, "admin-status.json"), - - // Temp transfer dir must not be in a volume - TEMP_TRANSFER_DIR: path.join("./", ".temp-transfer"), - // Must NOT be an absolute path to work from inside the DAPPMANAGER and out - /** Relative path to global ENVs from a core DNP docker-compose */ - GLOBAL_ENVS_PATH_FOR_CORE: path.relative(DNCORE_DIR, GLOBAL_ENVS_PATH), - GLOBAL_ENVS_PATH_FOR_DNP: GLOBAL_ENVS_PATH, - GLOBAL_ENVS_PATH: GLOBAL_ENVS_PATH, - PRIVATE_KEY_PATH: path.join(DNCORE_DIR, ".indentity.private.key"), - // Host script paths - HOST_SCRIPTS_DIR_FROM_HOST: path.join(HOST_HOME, "DNCORE/scripts/host"), - HOST_SCRIPTS_DIR: "DNCORE/scripts/host", - HOST_SCRIPTS_SOURCE_DIR: "hostScripts", - // Host services paths - HOST_SERVICES_DIR_FROM_HOST: path.join(HOST_HOME, "DNCORE/services/host"), - HOST_SYSTEMD_DIR_FROM_HOST: "/etc/systemd/system", - HOST_SERVICES_DIR: "DNCORE/services/host", - HOST_SERVICES_SOURCE_DIR: "hostServices", - // Local fallback versions, to be able to install and eth client without connecting to remote - FALLBACK_VERSIONS_PATH: path.join(DNCORE_DIR, "packages-content-hash.csv"), - // Version data file, created in the docker image build process - GIT_DATA_PATH: process.env.GIT_DATA_PATH || ".git-data.json", - // UI static files - UI_FILES_PATH: process.env.UI_FILES_PATH || "dist", - - // Signature API - SIGNATURE_PREFIX: "\x1dDappnode Signed Message:", - - DAPPNODE_REGISTRY: ".dnp.dappnode.eth", - - // HTTP API parameters - /** Use the internal ipfs gateway proxy so the UI works served from the HTTPs Portal */ - IPFS_GATEWAY: "/ipfs/", - TEST_API_PORT: 7000, - HTTP_API_PORT: process.env.HTTP_API_PORT || 80, - HTTP_CORS_WHITELIST: [ - "http://localhost:3000", - "http://localhost:3001", - "http://my.dappnode", - "http://dappnode.local" - ], - - // API auth sessions - SESSIONS_SECRET_FILE: path.join(DNCORE_DIR, "sessions-secret-key.txt"), - SESSIONS_MAX_TTL_MS: 7 * DAY, - SESSIONS_TTL_MS: 7 * DAY, - - // VPN API - VPN_API_RPC_URL: "http://vpn.dappnode:3000/rpc", - - // HTTPS Portal API URL - HTTPS_PORTAL_API_URL: "http://https.dappnode:5000", - HTTPS_PORTAL_DNPNAME: "https.dnp.dappnode.eth", - HTTPS_PORTAL_ISCORE: true, - HTTPS_PORTAL_MAIN_SERVICE: "https.dnp.dappnode.eth", - HTTPS_PORTAL_LOCAL_PROXYING_ENVNAME: "LOCAL_PROXYING", - - // Wireguard params - WIREGUARD_DNP_NAME: "wireguard.dnp.dappnode.eth", - WIREGUARD_ISCORE: true, - WIREGUARD_MAIN_SERVICE: "wireguard", - /** api.wireguard.dappnode/:device */ - WIREGUARD_API_URL: "http://api.wireguard.dappnode", - WIREGUARD_DEVICES_ENVNAME: "PEERS", - - // Docker compose parameters - DNS_SERVICE: "172.33.1.2", - DNP_PRIVATE_NETWORK_SUBNET: "172.33.0.0/16", - DNP_PRIVATE_NETWORK_NAME: "dncore_network", - DNP_PRIVATE_NETWORK_NAME_FROM_CORE: "network", - DNP_EXTERNAL_NETWORK_NAME: "dnpublic_network", - // Use of new compose file feature: network name - MINIMUM_COMPOSE_VERSION: "3.5", - - CONTAINER_NAME_PREFIX: "DAppNodePackage-", - CONTAINER_CORE_NAME_PREFIX: "DAppNodeCore-", - CONTAINER_TOOL_NAME_PREFIX: "DAppNodeTool-", - // Docker volume parameters - MOUNTPOINT_DEVICE_PREFIX: "dappnode-volumes", - - // Auto-update parameters - AUTO_UPDATE_DELAY: 1 * DAY, - AUTO_UPDATE_INCLUDE_IPFS_VERSIONS: false, - - // Watchers - AUTO_UPDATE_DAEMON_INTERVAL: 5 * MINUTE, - CHECK_DISK_USAGE_DAEMON_INTERVAL: 1 * MINUTE, - NAT_RENEWAL_DAEMON_INTERVAL: 1 * HOUR, - NSUPDATE_DAEMON_INTERVAL: 1 * HOUR, - ETH_METRICS_DAEMON_INTERVAL: 50 * MINUTE, - ETH_METRICS_DAEMON_INTERVAL_VARIATION: 10 * MINUTE, - - // IPFS parameters - IPFS_HOST: process.env.IPFS_HOST || process.env.IPFS_REDIRECT, - IPFS_TIMEOUT: 0.5 * MINUTE, - IPFS_LOCAL: "http://ipfs.dappnode:5001", - IPFS_REMOTE: "https://gateway.ipfs.dappnode.io", - - // Web3 parameters - ETH_MAINNET_RPC_URL_OVERRIDE: process.env.ETH_MAINNET_RPC_OVERRIDE, - ETH_MAINNET_RPC_URL_REMOTE: - process.env.ETH_MAINNET_RPC_URL_REMOTE || "https://web3.dappnode.net", - ETH_MAINNET_CHECKPOINTSYNC_URL_REMOTE: "https://checkpoint-sync.dappnode.io", - - // Prysm legacy specs for: prater, gnosis and mainnet - prysmLegacySpecs: [ - // v0.2.46 - { - prysmDnpName: "prysm-prater.dnp.dappnode.eth", - prysmVersion: "0.1.7", - web3signerDnpName: "web3signer-prater.dnp.dappnode.eth", - incompatibleClientsDnpNames: [ - "teku-prater.dnp.dappnode.eth", - "lighthouse-prater.dnp.dappnode.eth", - "nimbus-prater.dnp.dappnode.eth", - "lodestar-prater.dnp.dappnode.eth" - ] - }, - // v0.2.51 - { - prysmDnpName: "gnosis-beacon-chain-prysm.dnp.dappnode.eth", - prysmVersion: "0.1.8", - web3signerDnpName: "web3signer-gnosis.dnp.dappnode.eth", - incompatibleClientsDnpNames: [ - "teku-gnosis.dnp.dappnode.eth", - "lighthouse-gnosis.dnp.dappnode.eth", - "nimbus-gnosis.dnp.dappnode.eth", - "lodestar-gnosis.dnp.dappnode.eth" - ] - }, - // v0.2.52 - { - prysmDnpName: "prysm.dnp.dappnode.eth", - prysmVersion: "1.0.25", - web3signerDnpName: "web3signer.dnp.dappnode.eth", - incompatibleClientsDnpNames: [ - "teku.dnp.dappnode.eth", - "lighthouse.dnp.dappnode.eth", - "nimbus.dnp.dappnode.eth", - "lodestar.dnp.dappnode.eth" - ] - } - ], - - // DAPPMANAGER alias - DAPPMANAGER_ALIASES: ["my.dappnode", "dappnode.local"], - - // DAppNode specific names - bindDnpName: "bind.dnp.dappnode.eth", - coreDnpName: "core.dnp.dappnode.eth", - dappmanagerDnpName: "dappmanager.dnp.dappnode.eth", - dappmanagerContainerName: "DAppNodeCore-dappmanager.dnp.dappnode.eth", - restartDnpName: "restart.dnp.dappnode.eth", - vpnDnpName: "vpn.dnp.dappnode.eth", - vpnContainerName: "DAppNodeCore-vpn.dnp.dappnode.eth", - wifiDnpName: "wifi.dnp.dappnode.eth", - wifiContainerName: "DAppNodeCore-wifi.dnp.dappnode.eth", - ipfsDnpName: "ipfs.dnp.dappnode.eth", - ipfsContainerName: "DAppNodeCore-ipfs.dnp.dappnode.eth", - vpnDataVolume: "dncore_vpndnpdappnodeeth_data", - restartContainerName: "DAppNodeTool-restart.dnp.dappnode.eth", - restartDnpVolumes: [ - "/usr/src/dappnode/DNCORE/:/usr/src/app/DNCORE/", - "/var/run/docker.sock:/var/run/docker.sock" - ], - corePackagesThatMustBeRunning: [ - "bind.dnp.dappnode.eth", - "dappmanager.dnp.dappnode.eth" - ], - corePackagesNotAutoupdatable: [ - "core.dnp.dappnode.eth", - "bind.dnp.dappnode.eth", - "dappmanager.dnp.dappnode.eth", - "ipfs.dnp.dappnode.eth", - "wifi.dnp.dappnode.eth" - ], - corePackagesNotRemovable: [ - "bind.dnp.dappnode.eth", - "dappmanager.dnp.dappnode.eth", - "ipfs.dnp.dappnode.eth", - "wifi.dnp.dappnode.eth" - ], - - // DYNDNS parameters - DYNDNS_HOST: "https://ns.dappnode.io", - DYNDNS_DOMAIN: "dyndns.dappnode.io", - DYNDNS_INTERVAL: 30 * 60 * 1000, // 30 minutes - - // Local domains - AVAHI_LOCAL_DOMAIN: "dappnode.local", - - // System file paths - HOSTNAME_PATH: "/etc/dappnodename", - STATIC_IP_PATH: "/usr/src/app/config/static_ip", - VPNDB_PATH: "/usr/src/app/secrets/vpndb.json", - - // Wi-Fi ENVs - WIFI_KEY_SSID: "SSID", - WIFI_KEY_PASSWORD: "WPA_PASSPHRASE", - - // Global ENVs names - GLOBAL_ENVS: { - ACTIVE: "_DAPPNODE_GLOBAL_ENVS_ACTIVE", - DOMAIN: "_DAPPNODE_GLOBAL_DOMAIN", // "" || "6b3d49d4965584c2.dyndns.dappnode.io" - STATIC_IP: "_DAPPNODE_GLOBAL_STATIC_IP", // "" || "138.68.106.96" - HOSTNAME: "_DAPPNODE_GLOBAL_HOSTNAME", // "6b3d49d4965584c2.dyndns.dappnode.io" || "138.68.106.96" - INTERNAL_IP: "_DAPPNODE_GLOBAL_INTERNAL_IP", // "192.168.0.1" - UPNP_AVAILABLE: "_DAPPNODE_GLOBAL_UPNP_AVAILABLE", // "true" || "false" - NO_NAT_LOOPBACK: "_DAPPNODE_GLOBAL_NO_NAT_LOOPBACK", // "true" || "false" - PUBKEY: "_DAPPNODE_GLOBAL_PUBKEY", // "0x048e66b3e549818ea2cb354fb70749f6c8de8fa484f7530fc447d5fe80a1c424e4f5ae648d648c980ae7095d1efad87161d83886ca4b6c498ac22a93da5099014a", - ADDRESS: "_DAPPNODE_GLOBAL_ADDRESS", // "0x6B3D49d4965584C28Fbf14B82b1012664a73b9Ab" - PUBLIC_IP: "_DAPPNODE_GLOBAL_PUBLIC_IP", // "138.68.106.96" - SERVER_NAME: "_DAPPNODE_GLOBAL_SERVER_NAME", // "MyDAppNode" - CONSENSUS_CLIENT_MAINNET: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_MAINNET", // "prysm.dnp.dappnode.eth" - EXECUTION_CLIENT_MAINNET: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_MAINNET", // "geth.dnp.dappnode.eth" - CONSENSUS_CLIENT_GNOSIS: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_GNOSIS", // "teku-gnosis.dnp.dappnode.eth" - EXECUTION_CLIENT_GNOSIS: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_GNOSIS", // "nethermind-xdai.dnp.dappnode.eth" - CONSENSUS_CLIENT_PRATER: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_PRATER", // "prysm-prater.dnp.dappnode.eth" - EXECUTION_CLIENT_PRATER: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_PRATER", // "goerli-geth.dnp.dappnode.eth" - CONSENSUS_CLIENT_LUKSO: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_LUKSO", // "prysm-lukso.dnp.dappnode.eth" - EXECUTION_CLIENT_LUKSO: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_LUKSO" // "lukso-geth.dnp.dappnode.eth", - }, - // Global ENVs dappnode prefix - GLOBAL_ENVS_PREFIX: "_DAPPNODE_GLOBAL_", - - // nsenter line to run commands on host - NSENTER_COMMAND: - "docker run --rm --privileged --pid=host -t alpine:3.8 nsenter -t 1 -m -u -n -i", - - // Use a deterministic predefined key for the ADMIN side (DAPPMANAGER's is generated) - ADMIN_NACL_SECRET_KEY: "DAppNodeDAppNodeDAppNodeDAppNodeDAppNodeDao=", - ADMIN_NACL_PUBLIC_KEY: "cYo1NA7/+PQ22PeqrRNGhs1B84SY/fuomNtURj5SUmQ=", - - // Fullnode names - ALLOWED_FULLNODE_DNP_NAMES: [ - "geth.dnp.dappnode.eth", - "parity.dnp.dappnode.eth" - ], - // Default fullnode alias - FULLNODE_ALIAS: "fullnode.dappnode", - - // ETHFORWARD / HTTP proxy params - ETHFORWARD_IPFS_REDIRECT: "http://ipfs.dappnode:8080", - ETHFORWARD_SWARM_REDIRECT: "http://swarm.dappnode", - ETHFORWARD_PIN_ON_VISIT: true, - - // API endpoint check tcp ports. req: /publicIp?tcpPorts=8092,1194 | res: /[{tcpPort, status}] - PORT_SCANNER_SERVICE_URL: "http://159.65.206.61:3030", - - // Flags - DISABLE_UPNP: /true/i.test(process.env.DISABLE_UPNP || ""), - AUTH_IP_ALLOW_LOCAL_IP: Boolean(process.env.AUTH_IP_ALLOW_LOCAL_IP), - TEST: Boolean(process.env.TEST), - - DEFAULT_RELEASE_TRUSTED_KEYS: [ - { - name: "DAppNode Association", - dnpNameSuffix: ".dnp.dappnode.eth", - signatureProtocol: "ECDSA_256" as const, - key: "0xf35960302a07022aba880dffaec2fdd64d5bf1c1" - }, - { - name: "Nethermind Ethereum client team (public)", - dnpNameSuffix: ".public.dappnode.eth", - signatureProtocol: "ECDSA_256" as const, - key: "0xbD404c6f101833b45fF45b80bEfBd17816376246" - }, - { - name: "Nethermind Ethereum client team (dnp)", - dnpNameSuffix: ".dnp.dappnode.eth", - signatureProtocol: "ECDSA_256" as const, - key: "0xbD404c6f101833b45fF45b80bEfBd17816376246" - }, - { - name: "Lodestar Ethereum consensus client team", - dnpNameSuffix: ".dnp.dappnode.eth", - signatureProtocol: "ECDSA_256" as const, - key: "0x9D055dd23de15114EC95921208c741873eDE8558" - }, - { - name: "ETC Cooperative", - dnpNameSuffix: ".public.dappnode.eth", - signatureProtocol: "ECDSA_256" as const, - key: "0xfB737B2bb2067C3f9E1448AA2D70D32Db4fb51C4" - } - ] -}; - -if (devMode) { - params.AUTO_UPDATE_DELAY = 3000; - params.AUTO_UPDATE_DAEMON_INTERVAL = 1000; - params.AUTO_UPDATE_INCLUDE_IPFS_VERSIONS = true; -} - -export default params; diff --git a/packages/dappmanager/src/utils/autoUpdateHelper.ts b/packages/dappmanager/src/utils/autoUpdateHelper.ts index 047a247ce..5786dc619 100644 --- a/packages/dappmanager/src/utils/autoUpdateHelper.ts +++ b/packages/dappmanager/src/utils/autoUpdateHelper.ts @@ -1,5 +1,5 @@ import * as db from "../db/index.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { eventBus } from "../eventBus.js"; import { pick, omit } from "lodash-es"; import { isVersionIdUpdated } from "./coreVersionId.js"; diff --git a/packages/dappmanager/src/utils/distributedFile.ts b/packages/dappmanager/src/utils/distributedFile.ts index fd25080bd..b25bc4bd4 100644 --- a/packages/dappmanager/src/utils/distributedFile.ts +++ b/packages/dappmanager/src/utils/distributedFile.ts @@ -1,5 +1,5 @@ import { DistributedFile } from "@dappnode/common"; -import params from "../params.js"; +import { params } from "@dappnode/params"; /** * Return a queriable gateway url for a distributed file diff --git a/packages/dappmanager/src/utils/getDappmanagerImage.ts b/packages/dappmanager/src/utils/getDappmanagerImage.ts index e926c3063..db5863eb4 100644 --- a/packages/dappmanager/src/utils/getDappmanagerImage.ts +++ b/packages/dappmanager/src/utils/getDappmanagerImage.ts @@ -1,5 +1,5 @@ import { listContainers } from "../modules/docker/api/index.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import memoize from "memoizee"; const dmName = params.dappmanagerDnpName; diff --git a/packages/dappmanager/src/utils/getPath.ts b/packages/dappmanager/src/utils/getPath.ts index 2f256526a..3ac04b91e 100644 --- a/packages/dappmanager/src/utils/getPath.ts +++ b/packages/dappmanager/src/utils/getPath.ts @@ -1,7 +1,7 @@ import fs from "fs"; import { omit } from "lodash-es"; import path from "path"; -import params from "../params.js"; +import { params } from "@dappnode/params"; /* * Generates file paths given a set of parameters. This tool helps diff --git a/packages/dappmanager/src/utils/getServerName.ts b/packages/dappmanager/src/utils/getServerName.ts index 35f091de2..b8ffaf1ef 100644 --- a/packages/dappmanager/src/utils/getServerName.ts +++ b/packages/dappmanager/src/utils/getServerName.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../logs.js"; import { isNotFoundError } from "./node.js"; diff --git a/packages/dappmanager/src/utils/getStaticIp.ts b/packages/dappmanager/src/utils/getStaticIp.ts index e7718e8e7..283f8e033 100644 --- a/packages/dappmanager/src/utils/getStaticIp.ts +++ b/packages/dappmanager/src/utils/getStaticIp.ts @@ -1,6 +1,6 @@ import fs from "fs"; import * as db from "../db/index.js"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import { logs } from "../logs.js"; import isIp from "is-ip"; import { isNotFoundError } from "./node.js"; diff --git a/packages/dappmanager/src/utils/getVersionData.ts b/packages/dappmanager/src/utils/getVersionData.ts index 173614df8..db5826cfb 100644 --- a/packages/dappmanager/src/utils/getVersionData.ts +++ b/packages/dappmanager/src/utils/getVersionData.ts @@ -2,7 +2,7 @@ import fs from "fs"; import { isEqual } from "lodash-es"; import memoize from "memoizee"; import { PackageVersionData } from "@dappnode/common"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import * as db from "../db/index.js"; /** diff --git a/packages/dappmanager/src/utils/seedPhrase.ts b/packages/dappmanager/src/utils/seedPhrase.ts index b8f03e707..d668c151f 100644 --- a/packages/dappmanager/src/utils/seedPhrase.ts +++ b/packages/dappmanager/src/utils/seedPhrase.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import params from "../params.js"; +import { params } from "@dappnode/params"; import * as db from "../db/index.js"; import { utils as ethersUtils } from "ethers"; diff --git a/packages/dappmanager/src/utils/shell.ts b/packages/dappmanager/src/utils/shell.ts index 8b51206b6..e690ae874 100644 --- a/packages/dappmanager/src/utils/shell.ts +++ b/packages/dappmanager/src/utils/shell.ts @@ -1,6 +1,6 @@ import util from "util"; import * as child from "child_process"; -import params from "../params.js"; +import { params } from "@dappnode/params"; const exec = util.promisify(child.exec); diff --git a/packages/dappmanager/src/utils/sign.ts b/packages/dappmanager/src/utils/sign.ts index 0a18b8f1e..666820c15 100644 --- a/packages/dappmanager/src/utils/sign.ts +++ b/packages/dappmanager/src/utils/sign.ts @@ -1,5 +1,5 @@ import { ethers } from "ethers"; -import params from "../params.js"; +import { params } from "@dappnode/params"; export function prepareMessageFromPackage({ packageEnsName,