mirror of
https://github.com/MrUnknownDE/utools.git
synced 2026-04-18 21:53:44 +02:00
add version on footer
This commit is contained in:
@@ -57,6 +57,10 @@ ENV PING_COUNT=4
|
||||
ENV GEOIP_CITY_DB=./data/GeoLite2-City.mmdb
|
||||
ENV GEOIP_ASN_DB=./data/GeoLite2-ASN.mmdb
|
||||
|
||||
# Define build argument and environment variable for Git commit SHA
|
||||
ARG GIT_COMMIT_SHA=unknown
|
||||
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA}
|
||||
|
||||
|
||||
# Run the app when the container launches
|
||||
CMD ["node", "server.js"]
|
||||
@@ -611,6 +611,14 @@ app.get('/api/lookup', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Version Endpunkt
|
||||
app.get('/api/version', (req, res) => {
|
||||
const commitSha = process.env.GIT_COMMIT_SHA || 'unknown';
|
||||
logger.info({ commitSha }, 'Version request received');
|
||||
res.json({ commitSha });
|
||||
});
|
||||
|
||||
|
||||
// --- Server starten ---
|
||||
initialize().then(() => {
|
||||
app.listen(PORT, () => {
|
||||
@@ -620,6 +628,7 @@ initialize().then(() => {
|
||||
logger.info(` http://localhost:${PORT}/api/ping?targetIp=<ip>`);
|
||||
logger.info(` http://localhost:${PORT}/api/traceroute?targetIp=<ip>`);
|
||||
logger.info(` http://localhost:${PORT}/api/lookup?targetIp=<ip>`);
|
||||
logger.info(` http://localhost:${PORT}/api/version`);
|
||||
});
|
||||
}).catch(error => {
|
||||
// Fehler bei der Initialisierung wurde bereits geloggt.
|
||||
|
||||
Reference in New Issue
Block a user