Moved build info to variables.js. Simplified info.js build readout. Added versions to user dropdown

This commit is contained in:
Glenn de Haan
2024-10-07 11:34:06 +02:00
parent 7fb9956c10
commit f13ed225b3
4 changed files with 13 additions and 6 deletions

View File

@@ -38,11 +38,7 @@ module.exports = () => {
/** /**
* Output build version * Output build version
*/ */
if(fs.existsSync('/etc/unifi_voucher_site_build')) { log.info(`[Version] Git: ${variables.gitTag}, Build: ${variables.gitBuild}`);
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 external config * Log external config

View File

@@ -1,3 +1,8 @@
/**
* Import base packages
*/
const fs = require('fs');
/** /**
* Import own modules * Import own modules
*/ */
@@ -36,5 +41,6 @@ module.exports = {
smtpUsername: config('smtp_username') || process.env.SMTP_USERNAME || '', smtpUsername: config('smtp_username') || process.env.SMTP_USERNAME || '',
smtpPassword: config('smtp_password') || process.env.SMTP_PASSWORD || '', smtpPassword: config('smtp_password') || process.env.SMTP_PASSWORD || '',
logLevel: config('log_level') || process.env.LOG_LEVEL || 'info', 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'
}; };

View File

@@ -367,6 +367,7 @@ if(variables.serviceWeb) {
res.render('voucher', { res.render('voucher', {
baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '', baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '',
gitTag: variables.gitTag, gitTag: variables.gitTag,
gitBuild: variables.gitBuild,
user: user, user: user,
userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '', userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '',
authDisabled: variables.authDisabled, authDisabled: variables.authDisabled,
@@ -414,6 +415,7 @@ if(variables.serviceWeb) {
res.render('status', { res.render('status', {
baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '', baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '',
gitTag: variables.gitTag, gitTag: variables.gitTag,
gitBuild: variables.gitBuild,
user: user, user: user,
userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '', userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '',
authDisabled: variables.authDisabled, authDisabled: variables.authDisabled,

View File

@@ -65,6 +65,9 @@
Logout Logout
</a> </a>
<% } %> <% } %>
<div class="px-4 py-1 text-xs text-center text-gray-600 dark:text-gray-400">
Git: <%= gitTag %> - Build: <%= gitBuild %>
</div>
</div> </div>
</div> </div>
</div> </div>