Files
request-portal/config/webpack-patch/monitoring.js
T
gorbenko.pavel ee78449131 Мониторинг: логи, ошибки и запись экрана портала заявок в monitoring.tnsu.kz
initMonitoring в onInit веб-части (один раз на страницу), service.name = requestPortal, токен — молча
через AAD веб-части (spfxTokenProvider). В package-solution.json запрос Logs.Write к регистрации
мониторинга. Хэш коммита сборки — патч webpack (config/webpack-patch.json): GIT_COMMIT, GITHUB_SHA или git.
Пакет @tnsu/monitoring-web ставится отдельно.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:16:55 +05:00

21 lines
887 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Хэш коммита сборки — в логи (git.commit) и записи экрана мониторинга: @tnsu/monitoring-web читает
// __TNSU_GIT_COMMIT__, а webpack подставляет его при сборке. Хэш — GIT_COMMIT или GITHUB_SHA пайплайна, иначе git.
const { execSync } = require('node:child_process');
const webpack = require('webpack');
function gitCommit() {
const fromEnv = process.env.GIT_COMMIT || process.env.GITHUB_SHA;
if (fromEnv) return fromEnv;
try {
return execSync('git rev-parse HEAD', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
} catch {
return '';
}
}
module.exports = function monitoringPatch(config) {
config.plugins = config.plugins || [];
config.plugins.push(new webpack.DefinePlugin({ __TNSU_GIT_COMMIT__: JSON.stringify(gitCommit()) }));
return config;
};