From 9d2e221900ad49215d7dab3597bad5e8ab779732 Mon Sep 17 00:00:00 2001 From: Yashodhan Date: Sat, 15 Jun 2024 15:20:06 +0530 Subject: [PATCH] Update to Node.js 20 and ensure compatibility across all files, add new features --- .env.example | 14 +++++++++----- .github/workflows/docker.yml | 12 ++++++------ Dockerfile | 14 ++++++++++++-- README.md | 2 +- package.json | 15 +++++++++++---- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/.env.example b/.env.example index 955f622..571db64 100644 --- a/.env.example +++ b/.env.example @@ -1,14 +1,18 @@ -# Plesk API Key +# Plesk API key PLESKKEY= -# Plesk URL -PLESKURL= - -# Cloudflare credentials +# Cloudflare API key CLOUDKEY= + +# Cloudflare email CLOUDEMAIL= + +# Cloudflare account ID CLOUDACCOUNTID= +# Plesk URL +PLESKURL= + # Email settings EMAIL= SENDER= diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 37e1340..f3da533 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,12 +18,12 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: '16' + node-version: '20' - name: Install dependencies run: npm install @@ -32,16 +32,16 @@ jobs: run: npm test - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Build and push Docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: push: true tags: ghcr.io/${{ github.repository_owner }}/cloudflare-plesk-dns-sync:latest diff --git a/Dockerfile b/Dockerfile index 544b2f8..54aa708 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,20 @@ -FROM node:16-alpine +# Use Node.js 20 as the base image +FROM node:20-alpine +# Set the working directory WORKDIR /app +# Copy package.json and package-lock.json COPY package*.json ./ + +# Install dependencies RUN npm install +# Copy the rest of the application code COPY . . -CMD ["node", "index.js"] +# Expose the port the app runs on (if applicable) +EXPOSE 3000 + +# Command to run the app +CMD ["node", "cli.js", "run"] diff --git a/README.md b/README.md index e6fa928..5ac65f1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# !!DO NOT USE THIS PROJECT IS IT NEVER TESTED FOR IT WORKING!! +# !!DO NOT USE THIS PROJECT IT HAS NEVER BEEN TESTED!! ---- # Cloudflare-Plesk-DNS-Sync diff --git a/package.json b/package.json index d534aeb..50214f9 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,15 @@ "description": "A script to synchronize ACME TXT records between Cloudflare and Plesk and provide additional DNS management automation.", "main": "index.js", "scripts": { - "start": "node index.js run", + "start": "node cli.js run", "setup": "node setup.js", "test": "jest", - "cleanup": "node index.js cleanup", - "renew-ssl": "node index.js renew-ssl" + "cleanup": "node cli.js cleanup", + "renew-ssl": "node cli.js renew-ssl", + "monitor-health": "node cli.js monitor-health", + "manage-settings": "node cli.js manage-settings", + "backup": "node cli.js backup", + "restore": "node cli.js restore" }, "dependencies": { "commander": "^9.0.0", @@ -21,5 +25,8 @@ "license": "MIT", "devDependencies": { "jest": "^29.7.0" + }, + "engines": { + "node": ">=20.0.0" } -} \ No newline at end of file +}