🏗️ Configured the service transporter
This commit is contained in:
@@ -30,7 +30,7 @@ const brokerConfig: BrokerOptions = {
|
|||||||
// Namespace of nodes to segment your nodes on the same network.
|
// Namespace of nodes to segment your nodes on the same network.
|
||||||
namespace: "",
|
namespace: "",
|
||||||
// Unique node identifier. Must be unique in a 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`
|
// Custom metadata store. Store here what you want. Accessing: `this.broker.metadata`
|
||||||
metadata: {},
|
metadata: {},
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ const brokerConfig: BrokerOptions = {
|
|||||||
// More info: https://moleculer.services/docs/0.14/networking.html
|
// 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.
|
// 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.
|
// 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.
|
// Define a cacher.
|
||||||
// More info: https://moleculer.services/docs/0.14/caching.html
|
// More info: https://moleculer.services/docs/0.14/caching.html
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const ApiService: ServiceSchema<ApiSettingsSchema> = {
|
|||||||
// More info about settings: https://moleculer.services/docs/0.14/moleculer-web.html
|
// More info about settings: https://moleculer.services/docs/0.14/moleculer-web.html
|
||||||
settings: {
|
settings: {
|
||||||
// Exposed port
|
// Exposed port
|
||||||
port: process.env.PORT != null ? Number(process.env.PORT) : 3000,
|
port: process.env.PORT != null ? Number(process.env.PORT) : 3060,
|
||||||
|
|
||||||
// Exposed IP
|
// Exposed IP
|
||||||
ip: "0.0.0.0",
|
ip: "0.0.0.0",
|
||||||
|
|||||||
@@ -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: {},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
26
services/qbittorrent.service.ts
Normal file
26
services/qbittorrent.service.ts
Normal file
@@ -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: {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user