@flowfuse/driver-localfs 2.21.3-88488c1-202509220522.0 → 2.21.3-c306fa4-202509221214.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release-publish.yml +1 -1
- package/localfs.js +17 -6
- package/package.json +1 -1
|
@@ -13,6 +13,6 @@ jobs:
|
|
|
13
13
|
with:
|
|
14
14
|
node-version: 18
|
|
15
15
|
- run: npm ci --omit=dev
|
|
16
|
-
- uses: JS-DevTools/npm-publish@
|
|
16
|
+
- uses: JS-DevTools/npm-publish@ad693561f8a5b5d4c76f14407da60aa15cb10f90 # v4.0.1
|
|
17
17
|
with:
|
|
18
18
|
token: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
package/localfs.js
CHANGED
|
@@ -228,12 +228,17 @@ async function getMQTTAgentList (driver) {
|
|
|
228
228
|
const agents = await driver._app.db.models.BrokerCredentials.findAll({
|
|
229
229
|
include: [{ model: driver._app.db.models.Team }]
|
|
230
230
|
})
|
|
231
|
+
const teamBrokerAgents = await driver._app.db.models.TeamBrokerAgent.findAll({
|
|
232
|
+
include: [{ model: driver._app.db.models.Team }]
|
|
233
|
+
})
|
|
231
234
|
|
|
235
|
+
agents.concat(teamBrokerAgents)
|
|
232
236
|
agents.forEach(async (agent) => {
|
|
233
237
|
if (agent.Team && agent.settings.port) {
|
|
234
238
|
driver._usedAgentPorts.add(agent.settings.port)
|
|
235
239
|
}
|
|
236
240
|
})
|
|
241
|
+
|
|
237
242
|
return agents
|
|
238
243
|
}
|
|
239
244
|
|
|
@@ -306,7 +311,9 @@ async function checkExistingMQTTAgents (driver) {
|
|
|
306
311
|
}
|
|
307
312
|
|
|
308
313
|
async function launchMQTTAgent (broker, driver) {
|
|
309
|
-
|
|
314
|
+
const agent = broker.constructor.name === 'TeamBrokerAgent'
|
|
315
|
+
|
|
316
|
+
logger.info(`[localfs] Starting MQTT Schema agent ${agent ? 'team-broker' : broker.hashid} for ${broker.Team.hashid}`)
|
|
310
317
|
const agentSettings = broker.settings
|
|
311
318
|
agentSettings.port = agentSettings.port || getNextFreePort(driver._usedAgentPorts, initialAgentPortNumber)
|
|
312
319
|
|
|
@@ -315,9 +322,12 @@ async function launchMQTTAgent (broker, driver) {
|
|
|
315
322
|
|
|
316
323
|
env.FORGE_TEAM_TOKEN = token
|
|
317
324
|
env.FORGE_URL = driver._app.config.base_url
|
|
318
|
-
env.FORGE_BROKER_ID = broker.hashid
|
|
325
|
+
env.FORGE_BROKER_ID = agent ? 'team-broker' : broker.hashid
|
|
319
326
|
env.FORGE_TEAM_ID = broker.Team.hashid
|
|
320
327
|
env.FORGE_PORT = agentSettings.port
|
|
328
|
+
if (agent) {
|
|
329
|
+
env.FORGE_TIMEOUT = 24
|
|
330
|
+
}
|
|
321
331
|
|
|
322
332
|
if (driver._app.config.node_path) {
|
|
323
333
|
env.PATH = process.env.PATH + path.delimiter + driver._app.config.node_path
|
|
@@ -325,8 +335,8 @@ async function launchMQTTAgent (broker, driver) {
|
|
|
325
335
|
env.PATH = process.env.PATH
|
|
326
336
|
}
|
|
327
337
|
|
|
328
|
-
const out = openSync(path.join(driver._rootDir, `/${broker.hashid}-out.log`), 'a')
|
|
329
|
-
const err = openSync(path.join(driver._rootDir, `/${broker.hashid}-out.log`), 'a')
|
|
338
|
+
const out = openSync(path.join(driver._rootDir, `/${agent ? 'team-broker-' + broker.Team.hashid : broker.hashid}-out.log`), 'a')
|
|
339
|
+
const err = openSync(path.join(driver._rootDir, `/${agent ? 'team-broker-' + broker.Team.hashid : broker.hashid}-out.log`), 'a')
|
|
330
340
|
|
|
331
341
|
fileHandles[broker.hashid] = {
|
|
332
342
|
out,
|
|
@@ -334,7 +344,7 @@ async function launchMQTTAgent (broker, driver) {
|
|
|
334
344
|
}
|
|
335
345
|
|
|
336
346
|
const processOptions = {
|
|
337
|
-
detached:
|
|
347
|
+
detached: false,
|
|
338
348
|
windowsHide: true,
|
|
339
349
|
stdio: ['ignore', out, err],
|
|
340
350
|
env,
|
|
@@ -760,9 +770,10 @@ module.exports = {
|
|
|
760
770
|
launchMQTTAgent(broker, this)
|
|
761
771
|
},
|
|
762
772
|
stopBrokerAgent: async (broker) => {
|
|
773
|
+
const agent = broker.constructor.name === 'TeamBrokerAgent'
|
|
763
774
|
const pid = broker.settings?.pid
|
|
764
775
|
const port = broker.settings?.port
|
|
765
|
-
logger.info(`Stopping MQTT Schema Agent ${broker.hashid}`)
|
|
776
|
+
logger.info(`Stopping MQTT Schema Agent ${agent ? 'team-broker' : broker.hashid} for ${broker.Team.hashid}`)
|
|
766
777
|
if (pid) {
|
|
767
778
|
try {
|
|
768
779
|
if (process.platform === 'win32') {
|