From 086e604f647a780c7c63d44797e96d69e36bc403 Mon Sep 17 00:00:00 2001 From: Jon Bergfeld Date: Sun, 29 Sep 2024 18:52:52 +0000 Subject: [PATCH] cleaned up html template --- src/app/server.js | 12 ++++-------- src/app/views/home.handlebars | 10 +++------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/app/server.js b/src/app/server.js index f77e0807..f9f47150 100644 --- a/src/app/server.js +++ b/src/app/server.js @@ -22,7 +22,7 @@ const client = new Pool({connectionString: dbconnection}); var databaseresults = ''; var port = process.env.PORT || 8080; -var message = process.env.MESSAGE || 'Hello world!'; +var message = process.env.MESSAGE || 'Hello World'; var renderPathPrefix = ( process.env.RENDER_PATH_PREFIX ? '/' + process.env.RENDER_PATH_PREFIX.replace(/^[\\/]+/, '').replace(/[\\/]+$/, '') : @@ -34,14 +34,12 @@ var handlerPathPrefix = ( '' ); +var githubRepo = 'https://github.com/jbergfeld/hello-kubernetes'; var namespace = process.env.KUBERNETES_NAMESPACE || '-'; var podName = process.env.KUBERNETES_POD_NAME || os.hostname(); var nodeName = process.env.KUBERNETES_NODE_NAME || '-'; var nodeOS = os.type() + ' ' + os.release(); var database = dbconnection; -var applicationVersion = JSON.parse(fs.readFileSync('package.json', 'utf8')).version; -var containerImage = process.env.CONTAINER_IMAGE || 'paulbouwer/hello-kubernetes:' + applicationVersion -var containerImageArch = JSON.parse(fs.readFileSync('info.json', 'utf8')).containerImageArch; var wizfilecontents = JSON.parse(fs.readFileSync('wizexercise.txt', 'utf8')).contents; logger.debug(); @@ -54,7 +52,6 @@ logger.debug('HANDLER_PATH_PREFIX=' + process.env.HANDLER_PATH_PREFIX); logger.debug('KUBERNETES_NAMESPACE=' + process.env.KUBERNETES_NAMESPACE); logger.debug('KUBERNETES_POD_NAME=' + process.env.KUBERNETES_POD_NAME); logger.debug('KUBERNETES_NODE_NAME=' + process.env.KUBERNETES_NODE_NAME); -logger.debug('CONTAINER_IMAGE=' + process.env.CONTAINER_IMAGE); // Handlers @@ -71,11 +68,10 @@ logger.debug('Serving from base path "' + handlerPathPrefix + '"'); app.get(handlerPathPrefix + '/', function (req, res) { res.render('home', { message: message, - namespace: namespace, pod: podName, - node: nodeName + ' (' + nodeOS + ')', + node: nodeOS, database: database, - container: containerImage + ' (' + containerImageArch + ')', + footer: githubRepo, data: databaseresults, wizfile: wizfilecontents, renderPathPrefix: renderPathPrefix diff --git a/src/app/views/home.handlebars b/src/app/views/home.handlebars index 06dd8446..e4783122 100644 --- a/src/app/views/home.handlebars +++ b/src/app/views/home.handlebars @@ -3,16 +3,12 @@
- - - - - + @@ -20,7 +16,7 @@ - + @@ -30,5 +26,5 @@
namespace:{{ namespace }}
pod: {{ pod }}
node:node OS: {{ node }}
{{ database }}
data:query results: {{ data }}