diff --git a/modules/info.js b/modules/info.js index fefb88a..586410f 100644 --- a/modules/info.js +++ b/modules/info.js @@ -38,11 +38,7 @@ module.exports = () => { /** * Output build version */ - if(fs.existsSync('/etc/unifi_voucher_site_build')) { - log.info(`[Version] Git: ${variables.gitTag}, Build: ${fs.readFileSync('/etc/unifi_voucher_site_build', 'utf-8')}`); - } else { - log.info(`[Version] Git: ${variables.gitTag}, Build: **DEVELOPMENT**`); - } + log.info(`[Version] Git: ${variables.gitTag}, Build: ${variables.gitBuild}`); /** * Log external config diff --git a/modules/variables.js b/modules/variables.js index a67b528..5590bef 100644 --- a/modules/variables.js +++ b/modules/variables.js @@ -1,3 +1,8 @@ +/** + * Import base packages + */ +const fs = require('fs'); + /** * Import own modules */ @@ -36,5 +41,6 @@ module.exports = { smtpUsername: config('smtp_username') || process.env.SMTP_USERNAME || '', smtpPassword: config('smtp_password') || process.env.SMTP_PASSWORD || '', logLevel: config('log_level') || process.env.LOG_LEVEL || 'info', - gitTag: process.env.GIT_TAG || 'master' + gitTag: process.env.GIT_TAG || 'master', + gitBuild: fs.existsSync('/etc/unifi_voucher_site_build') ? fs.readFileSync('/etc/unifi_voucher_site_build', 'utf-8') : 'Development' }; diff --git a/server.js b/server.js index 1b0ac80..f605d96 100644 --- a/server.js +++ b/server.js @@ -367,6 +367,7 @@ if(variables.serviceWeb) { res.render('voucher', { baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '', gitTag: variables.gitTag, + gitBuild: variables.gitBuild, user: user, userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '', authDisabled: variables.authDisabled, @@ -414,6 +415,7 @@ if(variables.serviceWeb) { res.render('status', { baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '', gitTag: variables.gitTag, + gitBuild: variables.gitBuild, user: user, userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '', authDisabled: variables.authDisabled, diff --git a/template/partials/navigation.ejs b/template/partials/navigation.ejs index c48c699..a97fab2 100644 --- a/template/partials/navigation.ejs +++ b/template/partials/navigation.ejs @@ -65,6 +65,9 @@ Logout <% } %> +
+ Git: <%= gitTag %> - Build: <%= gitBuild %> +