remove default env values. correct package json with env vars .

This commit is contained in:
Первов Артем
2026-06-19 09:41:16 +03:00
parent 10dbdb2120
commit cbe33500cf
7 changed files with 8 additions and 13 deletions

View File

@@ -10,4 +10,4 @@ COPY public ./public
# Runtime mappers read JSON files from src/mappings, so they must be copied into the image.
COPY src ./src
CMD ["npm", "run", "dev"]
CMD ["npm", "run", "start"]

View File

@@ -3,9 +3,9 @@
"private": true,
"type": "module",
"scripts": {
"dev": "tsx watch --env-file=.env src/index.ts",
"dev": "tsx watch src/index.ts",
"build": "tsc",
"start": "node --env-file=.env dist/index.js"
"start": "tsx src/index.ts"
},
"dependencies": {
"@types/node": "^25.9.1",

View File

@@ -1,7 +1,4 @@
const DEFAULT_CLOUD_INGEST_URL = 'http://localhost:3101/ingest'
export const cloudIngestUrl =
process.env.CLOUD_INGEST_URL ?? DEFAULT_CLOUD_INGEST_URL
export const cloudIngestUrl = process.env.CLOUD_INGEST_URL as string
export function postCloudIngest(body: unknown): Promise<Response> {
return fetch(cloudIngestUrl, {

View File

@@ -5,9 +5,7 @@ import type { TopicHandler } from '../types.js'
export const TOPIC = 'data/edge5/modbus/v2'
const mapper = createMetricMapper({
filePath:
process.env.EDGE5_MODBUS_V2_MAPPING_FILE ??
new URL('../mappings/edge5-modbus.json', import.meta.url),
filePath: process.env.EDGE5_MODBUS_V2_MAPPING_FILE as string,
})
const REGISTER_COUNT = mapper.tagCount

View File

@@ -3,7 +3,7 @@ import { createServer } from 'node:http'
import { dirname, join } from 'node:path'
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 indexPath = join(publicDir, 'index.html')

View File

@@ -3,7 +3,7 @@ import mqtt from 'mqtt'
import { getRegisteredTopics } from './registry.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)

View File

@@ -1,7 +1,7 @@
import type { IncomingMessage } from 'http'
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 clients = new Set<WebSocket>()