Skip to content

Commit

Permalink
custom port + git pull
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Feb 28, 2024
1 parent e9102d7 commit f7561c6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,3 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Deploy
run: curl -X POST ${{ secrets.WEBHOOK }}
3 changes: 3 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Server Port
port =

# Sentry DSN
sentry_dsn =
19 changes: 16 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const express = require("express");
const app = express();

require("dotenv").config();
const port = 3000;
const port = process.env.port || 3000;

const Sentry = require("@sentry/node");
const bodyParser = require("body-parser");
Expand Down Expand Up @@ -35,5 +35,18 @@ app.use("/", router);
app.use(Sentry.Handlers.errorHandler());

app.listen(port, () => {
console.log(`[API] Listening on Port: ${port}`);
})
console.log(`Listening on Port: ${port}`);
})

const { exec } = require("child_process");

// Automatic Git Pull
setInterval(() => {
exec("git pull", (err, stdout) => {
if(err) return console.log(err);
if(stdout.includes("Already up to date.")) return;

console.log(stdout);
process.exit();
})
}, 30 * 1000) // 30 seconds

0 comments on commit f7561c6

Please sign in to comment.