From 4c6b848fb2e8a494b70661e618e5b9686006a034 Mon Sep 17 00:00:00 2001 From: Thorsten Zoerner Date: Mon, 5 Feb 2024 13:59:47 +0100 Subject: [PATCH] Fix: Specify main in package.json to allow embedded usage of EAF. --- framework/index.js | 16 ++++++++++++++++ framework/moleculer.config.js | 2 +- framework/package.json | 1 + framework/services/api-eaf.service.js | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 framework/index.js diff --git a/framework/index.js b/framework/index.js new file mode 100644 index 0000000..518165e --- /dev/null +++ b/framework/index.js @@ -0,0 +1,16 @@ +module.exports = { + node: function() { + var os = require("os"); + + if(typeof process.env["EAF_NODE_ID"] == 'undefined') { + process.env["EAF_NODE_ID"] = 'node_'+os.hostname(); + } + const { Runner } = require("moleculer"); + let runnerArgs = []; + runnerArgs.push(process.argv[0]); + runnerArgs.push(process.argv[1]); + const runner = new Runner(); + runner.start(runnerArgs); + + } +} \ No newline at end of file diff --git a/framework/moleculer.config.js b/framework/moleculer.config.js index 8d734ce..0f87f9b 100644 --- a/framework/moleculer.config.js +++ b/framework/moleculer.config.js @@ -68,7 +68,7 @@ module.exports = { // Define a cacher. // More info: https://moleculer.services/docs/0.14/caching.html - cacher: null, + cacher: "Memory", // Define a serializer. // Available values: "JSON", "Avro", "ProtoBuf", "MsgPack", "Notepack", "Thrift". diff --git a/framework/package.json b/framework/package.json index 5aded2f..fadc7f3 100644 --- a/framework/package.json +++ b/framework/package.json @@ -43,6 +43,7 @@ "stromdao", "tariff" ], + "main": "./index.js", "author": "STROMDAO GmbH ", "license": "Apache-2.0", "bugs": { diff --git a/framework/services/api-eaf.service.js b/framework/services/api-eaf.service.js index 259a031..e1e3068 100644 --- a/framework/services/api-eaf.service.js +++ b/framework/services/api-eaf.service.js @@ -13,6 +13,7 @@ const ApiGateway = require("moleculer-web"); module.exports = { name: "api-eaf", mixins: [ApiGateway], + cacher: "Memory", /** @type {ApiSettingsSchema} More info about settings: https://moleculer.services/docs/0.14/moleculer-web.html */ settings: {