*re-structure code
This commit is contained in:
parent
a1abf09c28
commit
243f350a54
|
@ -6,7 +6,7 @@ import BConfig from "bcfg";
|
|||
import * as os from "os";
|
||||
|
||||
import path from "path";
|
||||
import { errorExit } from "./error.js";
|
||||
import { errorExit } from "./lib/error.js";
|
||||
|
||||
const config = new BConfig("lumeweb-relay");
|
||||
|
||||
|
|
12
src/index.ts
12
src/index.ts
|
@ -1,11 +1,11 @@
|
|||
import { start as startRpc } from "./rpc.js";
|
||||
import { start as startRelay } from "./relay.js";
|
||||
import { start as startApp } from "./app";
|
||||
import { start as startRpc } from "./modules/rpc.js";
|
||||
import { start as startRelay } from "./modules/relay.js";
|
||||
import { start as startApp } from "./modules/app";
|
||||
import log from "loglevel";
|
||||
import config from "./config.js";
|
||||
import { loadPlugins } from "./plugin.js";
|
||||
import { start as startDns } from "./dns.js";
|
||||
import { start as startSSl } from "./ssl.js";
|
||||
import { loadPlugins } from "./modules/plugin.js";
|
||||
import { start as startDns } from "./modules/dns.js";
|
||||
import { start as startSSl } from "./modules/ssl.js";
|
||||
|
||||
log.setDefaultLevel(config.str("log-level"));
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import config from "./config";
|
||||
import config from "../config";
|
||||
import { seedPhraseToSeed } from "libskynet";
|
||||
|
||||
export function dynImport(module: string) {
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
// @ts-ignore
|
||||
import DHT from "@hyperswarm/dht";
|
||||
import config from "./config.js";
|
||||
import { errorExit } from "./error.js";
|
||||
import config from "../config.js";
|
||||
import { errorExit } from "../lib/error.js";
|
||||
import {
|
||||
deriveMyskyRootKeypair,
|
||||
seedPhraseToSeed,
|
|
@ -2,7 +2,7 @@ import cron from "node-cron";
|
|||
import { get as getDHT } from "./dht.js";
|
||||
import { Buffer } from "buffer";
|
||||
import { pack } from "msgpackr";
|
||||
import config from "./config.js";
|
||||
import config from "../config.js";
|
||||
import log from "loglevel";
|
||||
import fetch from "node-fetch";
|
||||
import { overwriteRegistryEntry } from "libskynetnode";
|
|
@ -1,5 +1,5 @@
|
|||
import config from "./config.js";
|
||||
import { getRpcServer } from "./rpc/server.js";
|
||||
import config from "../config.js";
|
||||
import { getRpcServer } from "../rpc/server.js";
|
||||
import type { PluginAPI, RPCMethod, Plugin } from "@lumeweb/relay-types";
|
||||
import slugify from "slugify";
|
||||
import * as fs from "fs";
|
||||
|
@ -14,13 +14,13 @@ import {
|
|||
setSslContext,
|
||||
} from "./ssl.js";
|
||||
import log from "loglevel";
|
||||
import { getSeed } from "./util.js";
|
||||
import { getSeed } from "../lib/util.js";
|
||||
import { getRouter, resetRouter, setRouter } from "./app.js";
|
||||
import {
|
||||
createIndependentFileSmall,
|
||||
openIndependentFileSmall,
|
||||
overwriteIndependentFileSmall,
|
||||
} from "./file";
|
||||
} from "../lib/file";
|
||||
import { setDnsProvider } from "./dns";
|
||||
|
||||
let pluginApi: PluginApiManager;
|
|
@ -5,7 +5,7 @@ import { relay } from "@hyperswarm/dht-relay";
|
|||
// @ts-ignore
|
||||
import Stream from "@hyperswarm/dht-relay/ws";
|
||||
import express, { Express } from "express";
|
||||
import config from "./config.js";
|
||||
import config from "../config.js";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import { get as getDHT } from "./dht.js";
|
|
@ -1,11 +1,11 @@
|
|||
//const require = createRequire(import.meta.url);
|
||||
//import { createRequire } from "module";
|
||||
|
||||
import config from "./config.js";
|
||||
import { errorExit } from "./error.js";
|
||||
import config from "../config.js";
|
||||
import { errorExit } from "../lib/error.js";
|
||||
// @ts-ignore
|
||||
import stringify from "json-stable-stringify";
|
||||
import { getRpcServer } from "./rpc/server.js";
|
||||
import { getRpcServer } from "../rpc/server.js";
|
||||
|
||||
export async function start() {
|
||||
if (!config.str("pocket-app-id") || !config.str("pocket-app-key")) {
|
|
@ -3,12 +3,12 @@ import {
|
|||
createIndependentFileSmall,
|
||||
openIndependentFileSmall,
|
||||
overwriteIndependentFileSmall,
|
||||
} from "./file.js";
|
||||
} from "../lib/file.js";
|
||||
// @ts-ignore
|
||||
import promiseRetry from "promise-retry";
|
||||
import config from "./config.js";
|
||||
import config from "../config.js";
|
||||
import log from "loglevel";
|
||||
import { getSeed } from "./util.js";
|
||||
import { getSeed } from "../lib/util.js";
|
||||
import type {
|
||||
IndependentFileSmall,
|
||||
SavedSslData,
|
|
@ -5,7 +5,7 @@ import {
|
|||
RPCStreamHandler,
|
||||
} from "@lumeweb/relay-types";
|
||||
import NodeCache from "node-cache";
|
||||
import { get as getDHT } from "../dht.js";
|
||||
import { get as getDHT } from "../modules/dht.js";
|
||||
import { Mutex } from "async-mutex";
|
||||
import crypto from "crypto";
|
||||
|
||||
|
|
Loading…
Reference in New Issue