test2
This commit is contained in:
parent
5b0fe3cff1
commit
3e77e08b24
@ -1,7 +1,8 @@
|
|||||||
FROM oven/bun:latest
|
FROM oven/bun:latest
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY config.json /etc/netgateswitch/config.json
|
VOLUME [ "/config"]
|
||||||
|
COPY config.json /config/config.json
|
||||||
RUN bun install --frozen-lockfile --production
|
RUN bun install --frozen-lockfile --production
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
EXPOSE 7000/tcp
|
EXPOSE 7000/tcp
|
||||||
|
@ -5,4 +5,4 @@ services:
|
|||||||
- '7000:7000'
|
- '7000:7000'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- /home/ns:/etc/netgateswitch:ro
|
- /home/ns:/config:ro
|
||||||
|
6
index.ts
6
index.ts
@ -1,6 +1,6 @@
|
|||||||
import { serve } from 'bun';
|
import { serve } from 'bun';
|
||||||
import { RouterOSAPI } from 'node-routeros';
|
import { RouterOSAPI } from 'node-routeros';
|
||||||
import cfg from '/etc/netgateswitch/config.json';
|
import cfg from '/config/config.json';
|
||||||
|
|
||||||
let api = new RouterOSAPI({
|
let api = new RouterOSAPI({
|
||||||
host: cfg.host,
|
host: cfg.host,
|
||||||
@ -184,7 +184,7 @@ async function writeConfig(
|
|||||||
cfg.proxycidr = pcidr;
|
cfg.proxycidr = pcidr;
|
||||||
|
|
||||||
haslogin = true;
|
haslogin = true;
|
||||||
await Bun.write('/etc/netgateswitch/config.json', JSON.stringify(cfg));
|
await Bun.write('/config/config.json', JSON.stringify(cfg));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cleanConfig() {
|
async function cleanConfig() {
|
||||||
@ -195,5 +195,5 @@ async function cleanConfig() {
|
|||||||
cfg.password = '';
|
cfg.password = '';
|
||||||
cfg.maincidr = '';
|
cfg.maincidr = '';
|
||||||
cfg.proxycidr = '';
|
cfg.proxycidr = '';
|
||||||
await Bun.write('/etc/netgateswitch/config.json', JSON.stringify(cfg));
|
await Bun.write('/config/config.json', JSON.stringify(cfg));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user