Fixing the testasset
This commit is contained in:
@@ -3,7 +3,7 @@ WORKDIR /usr/src/app
|
|||||||
ENV AM_I_IN_A_DOCKER_CONTAINER Yes
|
ENV AM_I_IN_A_DOCKER_CONTAINER Yes
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install
|
RUN npm ci
|
||||||
|
|
||||||
COPY testasset.js .
|
COPY testasset.js .
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Hinweise Testasset
|
||||||
|
|
||||||
|
Wichtig ist hier der Broker, welcher einfach mit `docker compose up -d mqttbroker` gestartet werden kann.
|
||||||
|
**Die dockerize-te Version der JS-Datei funktioniert nicht.**
|
||||||
|
Ich weiß nicht warum, aber einfach lokal starten (vorher natürlich `npm install`) sollte klappen.
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
- `testasset/testparam1`: Integer
|
||||||
|
- `testasset/testparam2`: Boolean
|
||||||
|
- `testasset/testparam2/write`: Schreiben von `testparam2`
|
||||||
|
- `testasset/testoperation1`: Keine Eingaben, keine Ausgabe (außer Logging), Inkrementiert `testparam1`
|
||||||
|
- `testasset/testoperation2`: JSON-Key `TestInput` als Eingabe, keine Ausgabe (außer Logging), Dekrementiert `testparam1`
|
||||||
|
- `testasset/testoperation3`: JSON-Key `TestInput` als Eingabe
|
||||||
|
- `testasset/testoperation3/result`: Ausgabe: `{"message": "Wuh", "input": <Input>, "error": false}`
|
||||||
@@ -13,5 +13,6 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
container_name: testasset
|
container_name: testasset
|
||||||
|
network_mode: host
|
||||||
depends_on:
|
depends_on:
|
||||||
- mqttbroker
|
- mqttbroker
|
||||||
@@ -3,7 +3,7 @@ import { v4 } from "uuid";
|
|||||||
|
|
||||||
// Is docker?
|
// Is docker?
|
||||||
const isDocker = process.env.AM_I_IN_A_DOCKER_CONTAINER ?? false;
|
const isDocker = process.env.AM_I_IN_A_DOCKER_CONTAINER ?? false;
|
||||||
const broker = isDocker ? "mqtt://mqttbroker:1883" : "mqtt://localhost:1883";
|
const broker = "mqtt://localhost:1883" // isDocker ? "mqtt://mqttbroker:1883" : "mqtt://localhost:1883";
|
||||||
|
|
||||||
const main = () => {
|
const main = () => {
|
||||||
console.log("Start")
|
console.log("Start")
|
||||||
|
|||||||
Reference in New Issue
Block a user