This commit is contained in:
parent
801e972800
commit
c220047a09
7 changed files with 92 additions and 28 deletions
25
.forgejo/workflows/build.yaml
Normal file
25
.forgejo/workflows/build.yaml
Normal file
|
@ -0,0 +1,25 @@
|
|||
name: build
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.cheetah.cat
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.PAT_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: git.cheetah.cat/smartpager/${{ github.event.repository.name }}:latest
|
17
Dockerfile
Normal file
17
Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
ARG NODE_VERSION=23.0.0
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine
|
||||
|
||||
ENV NODE_ENV production
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json .
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
USER node
|
||||
EXPOSE 3050
|
||||
|
||||
CMD node index.js
|
20
compose.yaml
Normal file
20
compose.yaml
Normal file
|
@ -0,0 +1,20 @@
|
|||
services:
|
||||
dispatcher:
|
||||
image: git.cheetah.cat/smartpager/dispatcher:latest
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
volumes:
|
||||
- ../dispatcher/config.json:/usr/src/app/config.json
|
||||
ports:
|
||||
- 3000:3000
|
||||
- 3001:3001
|
||||
msg_dwd:
|
||||
build:
|
||||
context: .
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
DISPATCHER: "dispatcher:3000"
|
||||
volumes:
|
||||
- ./config.json:/usr/src/app/config.json
|
||||
ports:
|
||||
- 3050:3050
|
8
config.default.json
Normal file
8
config.default.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"pager": {
|
||||
"url": "http://<DISPATCHER>/api/message/advanced"
|
||||
},
|
||||
"germanUmlautSupport": true,
|
||||
"regions": [
|
||||
]
|
||||
}
|
19
config.json
19
config.json
|
@ -1,25 +1,8 @@
|
|||
{
|
||||
"pager": {
|
||||
"url": "http://127.0.0.1:3000/api/message/advanced"
|
||||
"url": "http://<DISPATCHER>/api/message/advanced"
|
||||
},
|
||||
"germanUmlautSupport": true,
|
||||
"regions": [
|
||||
{
|
||||
"name": "Magdeburg",
|
||||
"active": true,
|
||||
"dwdID": "mdx",
|
||||
"preset": "184d015919c",
|
||||
"levels": {
|
||||
"wind_storm": 1,
|
||||
"thunderstorm": 1,
|
||||
"rain1": 2,
|
||||
"rain2": 2,
|
||||
"snow": 1,
|
||||
"ice": 666,
|
||||
"frost": 1,
|
||||
"fog": 1,
|
||||
"other": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
23
index.js
23
index.js
|
@ -1,17 +1,28 @@
|
|||
const fs = require('fs')
|
||||
|
||||
const config = require('./config.json')
|
||||
|
||||
const io = require("socket.io-client")
|
||||
const actualConfig = require('./config.json')
|
||||
const defaultConfig = require('./config.default.json')
|
||||
const config = defaultConfig
|
||||
Object.assign(config, actualConfig)
|
||||
let dispatcherHost = "127.0.0.1:3000"
|
||||
if (!!process.env.DISPATCHER) {
|
||||
console.log("docker mode")
|
||||
dispatcherHost = process.env.DISPATCHER
|
||||
config.pager.url = `http://${ dispatcherHost }/api/message/advanced`
|
||||
}
|
||||
|
||||
|
||||
// const io = require("socket.io-client")
|
||||
const axios = require('axios')
|
||||
const socket = io(new URL(config.pager.url).origin)
|
||||
// const socket = io(new URL(config.pager.url).origin)
|
||||
|
||||
const { read } = require('feed-reader')
|
||||
|
||||
const stateMachine = {}
|
||||
socket.on('msgmgr:event', async (eventType, eventData) => {
|
||||
console.log(eventType, eventData)
|
||||
})
|
||||
// socket.on('msgmgr:event', async (eventType, eventData) => {
|
||||
// console.log(eventType, eventData)
|
||||
// })
|
||||
const umlautMapGermany = {
|
||||
'\u00dc': ']',
|
||||
'\u00c4': '[',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "msg-email",
|
||||
"name": "msg-dwd",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
@ -8,14 +8,14 @@
|
|||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/smartpager-network/msg-email.git"
|
||||
"url": "git+https://git.cheetah.cat/smartpager/msg-dwd.git"
|
||||
},
|
||||
"author": "catSIXe",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/smartpager-network/msg-email/issues"
|
||||
"url": "https://git.cheetah.cat/smartpager/msg-dwd/issues"
|
||||
},
|
||||
"homepage": "https://github.com/smartpager-network/msg-email#readme",
|
||||
"homepage": "https://git.cheetah.cat/smartpager/msg-dwd#readme",
|
||||
"dependencies": {
|
||||
"@mdi/font": "^7.0.96",
|
||||
"axios": "^0.21.1",
|
||||
|
|
Loading…
Add table
Reference in a new issue