remove default env values. correct package json with env vars .
This commit is contained in:
@@ -10,4 +10,4 @@ COPY public ./public
|
|||||||
# Runtime mappers read JSON files from src/mappings, so they must be copied into the image.
|
# Runtime mappers read JSON files from src/mappings, so they must be copied into the image.
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
|
||||||
CMD ["npm", "run", "dev"]
|
CMD ["npm", "run", "start"]
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tsx watch --env-file=.env src/index.ts",
|
"dev": "tsx watch src/index.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"start": "node --env-file=.env dist/index.js"
|
"start": "tsx src/index.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "^25.9.1",
|
"@types/node": "^25.9.1",
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
const DEFAULT_CLOUD_INGEST_URL = 'http://localhost:3101/ingest'
|
export const cloudIngestUrl = process.env.CLOUD_INGEST_URL as string
|
||||||
|
|
||||||
export const cloudIngestUrl =
|
|
||||||
process.env.CLOUD_INGEST_URL ?? DEFAULT_CLOUD_INGEST_URL
|
|
||||||
|
|
||||||
export function postCloudIngest(body: unknown): Promise<Response> {
|
export function postCloudIngest(body: unknown): Promise<Response> {
|
||||||
return fetch(cloudIngestUrl, {
|
return fetch(cloudIngestUrl, {
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import type { TopicHandler } from '../types.js'
|
|||||||
export const TOPIC = 'data/edge5/modbus/v2'
|
export const TOPIC = 'data/edge5/modbus/v2'
|
||||||
|
|
||||||
const mapper = createMetricMapper({
|
const mapper = createMetricMapper({
|
||||||
filePath:
|
filePath: process.env.EDGE5_MODBUS_V2_MAPPING_FILE as string,
|
||||||
process.env.EDGE5_MODBUS_V2_MAPPING_FILE ??
|
|
||||||
new URL('../mappings/edge5-modbus.json', import.meta.url),
|
|
||||||
})
|
})
|
||||||
const REGISTER_COUNT = mapper.tagCount
|
const REGISTER_COUNT = mapper.tagCount
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { createServer } from 'node:http'
|
|||||||
import { dirname, join } from 'node:path'
|
import { dirname, join } from 'node:path'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
const httpPort = Number(process.env.HTTP_PORT ?? 80)
|
const httpPort = Number(process.env.HTTP_PORT)
|
||||||
const publicDir = join(dirname(fileURLToPath(import.meta.url)), '../../public')
|
const publicDir = join(dirname(fileURLToPath(import.meta.url)), '../../public')
|
||||||
const indexPath = join(publicDir, 'index.html')
|
const indexPath = join(publicDir, 'index.html')
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import mqtt from 'mqtt'
|
|||||||
import { getRegisteredTopics } from './registry.js'
|
import { getRegisteredTopics } from './registry.js'
|
||||||
import { routeMessage } from './router.js'
|
import { routeMessage } from './router.js'
|
||||||
|
|
||||||
const mqttUrl = process.env.MQTT_URL ?? 'mqtt://localhost:1883'
|
const mqttUrl = process.env.MQTT_URL as string
|
||||||
|
|
||||||
export const mqttClient = mqtt.connect(mqttUrl)
|
export const mqttClient = mqtt.connect(mqttUrl)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { IncomingMessage } from 'http'
|
import type { IncomingMessage } from 'http'
|
||||||
import { WebSocket, WebSocketServer } from 'ws'
|
import { WebSocket, WebSocketServer } from 'ws'
|
||||||
|
|
||||||
const wsPort = Number(process.env.WS_PORT ?? 9090)
|
const wsPort = Number(process.env.WS_PORT)
|
||||||
|
|
||||||
const wss = new WebSocketServer({ port: wsPort, perMessageDeflate: false })
|
const wss = new WebSocketServer({ port: wsPort, perMessageDeflate: false })
|
||||||
const clients = new Set<WebSocket>()
|
const clients = new Set<WebSocket>()
|
||||||
|
|||||||
Reference in New Issue
Block a user