From 3e77e08b243d05cb7da45e24c2424f29e73a4d1c Mon Sep 17 00:00:00 2001 From: Ziyunhui Date: Mon, 5 Aug 2024 13:34:44 +0800 Subject: [PATCH] test2 --- Dockerfile | 3 ++- compose.yaml | 2 +- index.ts | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5215fef..c9f6d1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ FROM oven/bun:latest WORKDIR /usr/src/app COPY . . -COPY config.json /etc/netgateswitch/config.json +VOLUME [ "/config"] +COPY config.json /config/config.json RUN bun install --frozen-lockfile --production ENV NODE_ENV=production EXPOSE 7000/tcp diff --git a/compose.yaml b/compose.yaml index ceaecf6..a4519a9 100644 --- a/compose.yaml +++ b/compose.yaml @@ -5,4 +5,4 @@ services: - '7000:7000' restart: unless-stopped volumes: - - /home/ns:/etc/netgateswitch:ro + - /home/ns:/config:ro diff --git a/index.ts b/index.ts index 4f7dfe8..8878718 100644 --- a/index.ts +++ b/index.ts @@ -1,6 +1,6 @@ import { serve } from 'bun'; import { RouterOSAPI } from 'node-routeros'; -import cfg from '/etc/netgateswitch/config.json'; +import cfg from '/config/config.json'; let api = new RouterOSAPI({ host: cfg.host, @@ -184,7 +184,7 @@ async function writeConfig( cfg.proxycidr = pcidr; haslogin = true; - await Bun.write('/etc/netgateswitch/config.json', JSON.stringify(cfg)); + await Bun.write('/config/config.json', JSON.stringify(cfg)); } async function cleanConfig() { @@ -195,5 +195,5 @@ async function cleanConfig() { cfg.password = ''; cfg.maincidr = ''; cfg.proxycidr = ''; - await Bun.write('/etc/netgateswitch/config.json', JSON.stringify(cfg)); + await Bun.write('/config/config.json', JSON.stringify(cfg)); }