From 43cf8801a0196f4e947a2566fe7aac0f8cac94c8 Mon Sep 17 00:00:00 2001 From: cpu Date: Fri, 28 Mar 2025 20:38:27 +0100 Subject: [PATCH] clean up --- .dockerignore | 1 + .env.example | 23 +++++++++++++++-------- .gitignore | 2 +- server.js | 2 +- virt-flic-webhook-webpush.service.example | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.dockerignore b/.dockerignore index d9c9c25..cd67c24 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,6 +7,7 @@ Dockerfile README.md *.example .env +env labels subscriptions.json diff --git a/.env.example b/.env.example index 7410146..ec16f9c 100644 --- a/.env.example +++ b/.env.example @@ -4,12 +4,15 @@ # Generate using: npx web-push generate-vapid-keys VAPID_PUBLIC_KEY= VAPID_PRIVATE_KEY= -VAPID_SUBJECT=mailto:mailto:admin@virtonline.eu # Contact email/URL for push service +VAPID_SUBJECT=mailto:mailto:admin@virtonline.eu # --- Server Configuration --- -PORT=3000 # Internal port for the Node.js app -SUBSCRIPTIONS_FILE=subscriptions.json # Path inside the container -DEFAULT_BUTTON_NAME=game-button # Default button name to use when not specified +# Internal port for the Node.js app +PORT=3000 +# Path inside the container +SUBSCRIPTIONS_FILE=/app/subscriptions.json +# Default button name to use when not specified +DEFAULT_BUTTON_NAME=game-button # --- Authentication (Optional) --- # If both USERNAME and PASSWORD are set, Basic Auth will be enabled for: @@ -28,12 +31,16 @@ ALLOWED_METHODS=POST,GET,OPTIONS ALLOWED_HEADERS=Content-Type,Authorization # --- Web Push Retry Configuration (Optional) --- -MAX_NOTIFICATION_RETRIES=3 # Number of retries on failure (e.g., DNS issues) -INITIAL_RETRY_DELAY_MS=1000 # Initial delay in milliseconds +# Number of retries on failure (e.g., DNS issues) +MAX_NOTIFICATION_RETRIES=3 +# Initial delay in milliseconds +INITIAL_RETRY_DELAY_MS=1000 # --- Network Configuration (Optional) --- -DNS_TIMEOUT_MS=5000 # Timeout for DNS lookups (ms) -HTTP_TIMEOUT_MS=10000 # Timeout for outgoing HTTP requests (ms) +# Timeout for DNS lookups (ms) +DNS_TIMEOUT_MS=5000 +# Timeout for outgoing HTTP requests (ms) +HTTP_TIMEOUT_MS=10000 # --- Logging --- # Controls log verbosity: error, warn, info, debug diff --git a/.gitignore b/.gitignore index a8c2dbd..7df275b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ npm-debug.log* yarn-debug.log* yarn-error.log* .env - +env # OS generated files .DS_Store .DS_Store? diff --git a/server.js b/server.js index 775967c..6a37b12 100644 --- a/server.js +++ b/server.js @@ -291,7 +291,7 @@ app.get('/webhook/:click_type', authenticateBasic, async (req, res) => { logger.debug(` ${headerName}: ${req.headers[headerName]}`); }); - logger.info(`Received GET webhook: Button=${buttonName}, Type=${click_type}, Battery=${batteryLevel}, Timestamp=${timestamp || 'N/A'}`); + logger.info(`Received GET webhook: Button=${buttonName}, Type=${click_type}, Battery=${batteryLevel}%, Timestamp=${timestamp || 'N/A'}`); // Basic validation if (!click_type) { diff --git a/virt-flic-webhook-webpush.service.example b/virt-flic-webhook-webpush.service.example index c9fd808..6b8d902 100644 --- a/virt-flic-webhook-webpush.service.example +++ b/virt-flic-webhook-webpush.service.example @@ -18,7 +18,7 @@ ExecStart=/usr/bin/env docker run \ --name=virt-flic-webhook-webpush \ --log-driver=none \ --network=traefik \ - --env-file=${APP_PATH}/.env \ + --env-file=${APP_PATH}/env \ --label-file=${APP_PATH}/labels \ --mount type=bind,src=${APP_PATH}/subscriptions.json,dst=/app/subscriptions.json \ flic-webhook-webpush