This repository was archived by the owner on Aug 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +6
-5
lines changed Expand file tree Collapse file tree 4 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -7,4 +7,4 @@ DEVS_LOCAL_USER_PASSWORD="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVE
7
7
DEVS_STORAGE_CONNECTION_STRING = " DefaultEndpointsProtocol=http;AccountName=$DEVS_LOCAL_USER_NAME ;AccountKey=$DEVS_LOCAL_USER_PASSWORD ;BlobEndpoint=http://127.0.0.1:10000/$DEVS_LOCAL_USER_NAME ;QueueEndpoint=http://127.0.0.1:10001/$DEVS_LOCAL_USER_NAME ;TableEndpoint=http://127.0.0.1:10002/$DEVS_LOCAL_USER_NAME ;"
8
8
DEVS_PASSWORDS = " $DEVS_LOCAL_USER_NAME :$DEVS_LOCAL_USER_PASSWORD "
9
9
DEVS_CONNECTION_STRING = " AccountName=$DEVS_LOCAL_USER_NAME ;AccountKey=$DEVS_LOCAL_USER_PASSWORD ;ApiRoot=$WEBSITE_PROTOCOL ://$WEBSITE_HOSTNAME "
10
- DEVS_MQTT_SERVER_DEV = " 1 "
10
+ DEVS_MQTT_SERVER = " mqtt://public.mqtthq.com:1883 "
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export async function initGatewayRoutes(server: FastifyInstance) {
11
11
res . mqtt = {
12
12
hostname : mqttUrl . hostname ,
13
13
path : mqttUrl . pathname ,
14
- port : mqttUrl . port ,
14
+ port : Number ( mqttUrl . port ) || 1883 ,
15
15
username : process . env . DEVS_MQTT_USER_NAME ,
16
16
password : process . env . DEVS_MQTT_USER_PASSWORD ,
17
17
}
Original file line number Diff line number Diff line change @@ -43,8 +43,9 @@ export async function setup() {
43
43
topicName : "*" ,
44
44
ingest : async ( topic , message , device ) => {
45
45
if ( ! client . connected ) return
46
-
47
- const mqTopic = `${ mqttTopicPrefix ( device . dev ) } /from/${ topic } `
46
+
47
+ // don't rewrite global topics
48
+ const mqTopic = / ~ \/ / . test ( topic ) ? topic . slice ( 1 ) : `${ mqttTopicPrefix ( device . dev ) } /from/${ topic } `
48
49
client . publish (
49
50
mqTopic ,
50
51
Buffer . from ( JSON . stringify ( message ) , "utf-8" ) ,
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ export function generateOpenApiSpec() {
64
64
"URL of the MQTT server"
65
65
) ,
66
66
path : sString ( "URL path if any" , "Path to the MQTT server" ) ,
67
- port : sString ( "mqtt port" , "Port to listen to" ) ,
67
+ port : sNumber ( "mqtt port" , "Port to listen to" ) ,
68
68
username : sString (
69
69
"MQTT user" ,
70
70
"username to connect to MQTT server"
You can’t perform that action at this time.
0 commit comments