This commit is contained in:
紫云徽 2024-08-05 13:34:44 +08:00
parent 5b0fe3cff1
commit 3e77e08b24
3 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -5,4 +5,4 @@ services:
- '7000:7000'
restart: unless-stopped
volumes:
- /home/ns:/etc/netgateswitch:ro
- /home/ns:/config:ro

View File

@ -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));
}