2021-02-09 09:26:07 +00:00
|
|
|
/**
|
|
|
|
* @author Martin Karkowski
|
|
|
|
* @email m.karkowski@zema.de
|
|
|
|
* @create date 2021-02-09 10:12:37
|
2021-02-26 09:22:32 +00:00
|
|
|
* @modify date 2021-02-26 08:53:56
|
2021-02-09 09:26:07 +00:00
|
|
|
* @desc [description]
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { hostname } from "os";
|
|
|
|
import { join, resolve } from "path";
|
|
|
|
import { createFile } from "../../../lib/helpers/fileMethods";
|
|
|
|
|
|
|
|
const name = hostname();
|
|
|
|
|
2021-02-26 09:22:32 +00:00
|
|
|
const num: number = +(name.split("-")[1]);
|
|
|
|
|
2021-02-09 09:26:07 +00:00
|
|
|
const config = {
|
|
|
|
functions: [],
|
|
|
|
packages: [
|
2021-02-12 16:37:24 +00:00
|
|
|
// Bridge
|
2021-02-09 09:26:07 +00:00
|
|
|
{
|
|
|
|
nameOfPackage: "bridgeLayer",
|
|
|
|
defaultInstances: [
|
|
|
|
{
|
|
|
|
options: {
|
|
|
|
identifier: ("wamo-" + name + "-bridge").toLowerCase(),
|
2021-02-12 16:39:19 +00:00
|
|
|
params: ["io-client", "http://localhost:7000"],
|
2021-02-09 09:26:07 +00:00
|
|
|
type: "AdditionalBridgeModule"
|
|
|
|
},
|
|
|
|
selector: "AdditionalBridgeModule"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
autostart: {},
|
|
|
|
path: "dist\\modules\\bridge\\src\\bridge.package.js"
|
|
|
|
},
|
2021-02-12 16:37:24 +00:00
|
|
|
// Beckhoff
|
2021-02-09 09:26:07 +00:00
|
|
|
{
|
|
|
|
nameOfPackage: "beckhoffPackage",
|
|
|
|
defaultInstances: [
|
|
|
|
{
|
|
|
|
options: {
|
|
|
|
identifier: name,
|
|
|
|
params: [
|
|
|
|
{
|
|
|
|
port: 48898,
|
|
|
|
amsPortSource: 32905,
|
|
|
|
amsPortTarget: 851,
|
|
|
|
timeout: 5000,
|
2021-02-26 09:22:32 +00:00
|
|
|
amsNetIdTarget: "1.1.1.1.1." + num.toString(),
|
2021-02-09 09:26:07 +00:00
|
|
|
amsNetIdSource: "2.2.2.2.2.2",
|
|
|
|
host: "localhost",
|
|
|
|
twinCatVersion: 3
|
|
|
|
}
|
|
|
|
],
|
|
|
|
type: "BeckhoffPlc"
|
|
|
|
},
|
|
|
|
selector: "BeckhoffPlc"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
autostart: {},
|
|
|
|
path:
|
|
|
|
"dist\\modules\\mod-Beckhoff-PLC-Interface\\src\\beckhoff.package.js"
|
|
|
|
},
|
2021-02-12 16:37:24 +00:00
|
|
|
// MQTT-Broker
|
2021-02-09 09:26:07 +00:00
|
|
|
{
|
|
|
|
nameOfPackage: "mqttBrokerPackage",
|
|
|
|
defaultInstances: [
|
|
|
|
{
|
|
|
|
options: {
|
|
|
|
identifier: ("wamo-" + name + "-mqtt-broker").toLowerCase(),
|
|
|
|
params: [],
|
|
|
|
type: "MQTTBrokerModule"
|
|
|
|
},
|
|
|
|
selector: "MQTTBrokerModule"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
autostart: {},
|
|
|
|
path: "dist\\modules\\mqtt-broker\\src\\mqtt.broker.package.js"
|
2021-02-12 16:37:24 +00:00
|
|
|
},
|
|
|
|
// Updater
|
|
|
|
{
|
|
|
|
nameOfPackage: "updaterPackage",
|
|
|
|
defaultInstances: [
|
|
|
|
{
|
|
|
|
options: {
|
2021-02-26 09:22:32 +00:00
|
|
|
identifier: ("wamo-" + name + "-updater").toLowerCase(),
|
2021-02-12 16:37:24 +00:00
|
|
|
params: [],
|
|
|
|
type: "UpdaterModule"
|
|
|
|
},
|
|
|
|
selector: "UpdaterModule"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
autostart: {},
|
|
|
|
path: "dist\\modules\\updater\\src\\updater.package.js"
|
|
|
|
},
|
|
|
|
// Evil
|
|
|
|
{
|
|
|
|
nameOfPackage: "evilPackage",
|
|
|
|
defaultInstances: [
|
|
|
|
{
|
|
|
|
options: {
|
|
|
|
identifier: ("wamo-" + name + "-evil-module").toLowerCase(),
|
|
|
|
params: [],
|
|
|
|
type: "EvilModule"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
autostart: {},
|
|
|
|
path: "dist\\modules\\evil\\src\\slave.package.js"
|
|
|
|
},
|
|
|
|
// HostManager:
|
|
|
|
{
|
|
|
|
nameOfPackage: "hostManagerPackage",
|
|
|
|
defaultInstances: [
|
|
|
|
{
|
|
|
|
options: {
|
|
|
|
identifier: ("wamo-" + name + "-host-manager").toLowerCase(),
|
|
|
|
params: [],
|
|
|
|
type: "HostManagerModule"
|
|
|
|
},
|
|
|
|
selector: "HostManagerModule"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
autostart: {},
|
|
|
|
path: "dist\\modules\\host-manager\\src\\hostManager.package.js"
|
2021-02-09 09:26:07 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
const pubSubConfig = {
|
|
|
|
nameOfPackage: "pubsubPackage",
|
|
|
|
defaultInstances: [
|
|
|
|
{
|
|
|
|
options: {
|
|
|
|
identifier: "pub-sub-system",
|
|
|
|
params: [],
|
|
|
|
type: "PubSubModule"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
autostart: {},
|
|
|
|
path: "dist\\modules\\pub-sub\\src\\pub-sub.package.js"
|
|
|
|
};
|
|
|
|
|
|
|
|
// Define the Filename for the Configuration
|
|
|
|
const filename: string = join(
|
|
|
|
resolve(process.cwd()),
|
|
|
|
"config",
|
|
|
|
"settings.json"
|
|
|
|
);
|
|
|
|
|
|
|
|
createFile(filename, JSON.stringify(config, undefined, 4)).then(() =>
|
|
|
|
console.log("Created Configuartion in", filename)
|
|
|
|
);
|