mirror of
https://github.com/DeNNiiInc/Web-Page-Performance-Test.git
synced 2026-04-17 20:05:58 +00:00
🚀 Setup automated deployment system with comprehensive credential protection
- Added Express server with Git info API endpoint - Created automated deployment scripts (systemd-based, not PM2) - Implemented 5-minute auto-sync with GitHub - Enhanced .gitignore with 200+ credential protection patterns - Added Git version badge to UI footer - Created comprehensive deployment documentation - Added TurnKey Nginx fix for default control panel issue - Included security verification tools All credentials protected and verified safe for deployment.
This commit is contained in:
42
server.js
Normal file
42
server.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const express = require("express");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { exec } = require("child_process");
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// Serve static files
|
||||
app.use(express.static(__dirname));
|
||||
|
||||
// API endpoint to get Git commit info
|
||||
app.get("/api/git-info", (req, res) => {
|
||||
exec('git log -1 --format="%H|%cr"', (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error("Error getting git info:", error);
|
||||
return res.json({
|
||||
commitId: "unknown",
|
||||
commitAge: "unknown",
|
||||
error: true,
|
||||
});
|
||||
}
|
||||
|
||||
const [commitId, commitAge] = stdout.trim().split("|");
|
||||
res.json({
|
||||
commitId: commitId.substring(0, 7),
|
||||
commitAge: commitAge,
|
||||
error: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Serve index.html for all other routes
|
||||
app.get("*", (req, res) => {
|
||||
res.sendFile(path.join(__dirname, "index.html"));
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`🚀 Server running on port ${PORT}`);
|
||||
console.log(`📁 Serving files from: ${__dirname}`);
|
||||
console.log(`🌐 Environment: ${process.env.NODE_ENV || "development"}`);
|
||||
});
|
||||
Reference in New Issue
Block a user