From 09061905bb74a01e0bf074ef2c41caed161edb67 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Fri, 1 Sep 2023 09:18:37 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=EF=B8=8F=20Configured=20the=20serv?= =?UTF-8?q?ice=20transporter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- moleculer.config.ts | 4 ++-- services/api.service.ts | 2 +- services/greeter.service.ts | 19 ------------------- services/qbittorrent.service.ts | 26 ++++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 22 deletions(-) delete mode 100644 services/greeter.service.ts create mode 100644 services/qbittorrent.service.ts diff --git a/moleculer.config.ts b/moleculer.config.ts index f429295..a35833d 100644 --- a/moleculer.config.ts +++ b/moleculer.config.ts @@ -30,7 +30,7 @@ const brokerConfig: BrokerOptions = { // Namespace of nodes to segment your nodes on the same network. namespace: "", // Unique node identifier. Must be unique in a namespace. - nodeID: null, + nodeID: "threetwo-acquistion-service", // Custom metadata store. Store here what you want. Accessing: `this.broker.metadata` metadata: {}, @@ -59,7 +59,7 @@ const brokerConfig: BrokerOptions = { // More info: https://moleculer.services/docs/0.14/networking.html // Note: During the development, you don't need to define it because all services will be loaded locally. // In production you can set it via `TRANSPORTER=nats://localhost:4222` environment variable. - transporter: null, // "Redis" + transporter: process.env.REDIS_URI || "redis://localhost:6379", // Define a cacher. // More info: https://moleculer.services/docs/0.14/caching.html diff --git a/services/api.service.ts b/services/api.service.ts index b430d4b..fc864ce 100644 --- a/services/api.service.ts +++ b/services/api.service.ts @@ -14,7 +14,7 @@ const ApiService: ServiceSchema = { // More info about settings: https://moleculer.services/docs/0.14/moleculer-web.html settings: { // Exposed port - port: process.env.PORT != null ? Number(process.env.PORT) : 3000, + port: process.env.PORT != null ? Number(process.env.PORT) : 3060, // Exposed IP ip: "0.0.0.0", diff --git a/services/greeter.service.ts b/services/greeter.service.ts deleted file mode 100644 index 500ffc3..0000000 --- a/services/greeter.service.ts +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -import { Context, Service, ServiceBroker, ServiceSchema, Errors } from "moleculer"; - -export default class TorrentService extends Service { - // @ts-ignore - public constructor( - public broker: ServiceBroker, - schema: ServiceSchema<{}> = { name: "torrent" }, - ) { - super(broker); - this.parseServiceSchema({ - name: "torrent", - mixins: [], - hooks: {}, - actions: {}, - methods: {}, - }); - } -} diff --git a/services/qbittorrent.service.ts b/services/qbittorrent.service.ts new file mode 100644 index 0000000..72f7368 --- /dev/null +++ b/services/qbittorrent.service.ts @@ -0,0 +1,26 @@ +"use strict"; +import { Context, Service, ServiceBroker, ServiceSchema, Errors } from "moleculer"; + +export default class QBittorrentService extends Service { + // @ts-ignore + public constructor( + public broker: ServiceBroker, + schema: ServiceSchema<{}> = { name: "qbittorrent" }, + ) { + super(broker); + this.parseServiceSchema({ + name: "qbittorrent", + mixins: [], + hooks: {}, + actions: { + connect: { + rest: "POST /connect", + handler: async (ctx: Context<{}>) => { + return { foo: "bar" }; + }, + }, + }, + methods: {}, + }); + } +}