Files
sparkantiplagiat-frontend/scripts/sync-env.cjs
Микаэл Оганесян 2016d9160c
Some checks failed
CI / checks (push) Failing after 9m18s
- Add PlagiarismGraphComponent (force-graph) with legend, abbreviated names,
risk-derived node colors, and particle animation; integrated into work, event,
  group, and student detail pages
- Extract domain API services (students, events, groups, reference-sets, users,
  analysis-runs, audit) from WorksApiService
- Add RiskLevelPipe for translating risk level values to Russian
- Replace raw IDs with entity names across all detail page overview sections
- Dashboard: remove Works tab, reorder tabs (Students, Events, Groups, Ref-sets),
  hide list cards when empty or on error
- Hide secondary blocks (runs, matches, graph, analytics) on error instead of
  showing error text; keep top-level entity load errors visible
- Refset detail: split Ingestions tab into separate list and upload cards;
  hide list card when empty or on error
- Convert analysis runs list to table; fix kv-grid vertical alignment
- Style native select[tuiSelect] to match other form fields
- Add favicon (yellow star) from sparkguardian
2026-04-18 15:31:09 +03:00

44 lines
1.3 KiB
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.
/**
* Генерирует `src/environments/environment.ts` из переменных окружения (.env).
* Значения по умолчанию совпадают с .env.example.
*/
const fs = require('fs');
const path = require('path');
require('dotenv').config({ path: path.join(__dirname, '..', '.env') });
const defaults = {
SG_API_FALLBACK_ORIGIN: 'http://spark.returntozer0.ru',
SG_API_BASE_PATH: '',
SG_DEFAULT_PAGE_LIMIT: '20',
};
function val(key) {
const v = process.env[key];
if (v !== undefined && v !== '') {
return v;
}
return defaults[key];
}
function intVal(key) {
const parsed = Number.parseInt(val(key), 10);
if (Number.isFinite(parsed)) {
return parsed;
}
return Number.parseInt(defaults[key], 10);
}
const content = `// Сгенерировано npm run env:sync — правьте .env и снова запустите sync
export const environment = {
production: false,
apiFallbackOrigin: ${JSON.stringify(val('SG_API_FALLBACK_ORIGIN'))},
apiBasePath: ${JSON.stringify(val('SG_API_BASE_PATH'))},
defaultPageLimit: ${JSON.stringify(intVal('SG_DEFAULT_PAGE_LIMIT'))},
} as const;
`;
const outPath = path.join(__dirname, '..', 'src', 'environments', 'environment.ts');
fs.writeFileSync(outPath, content, 'utf8');
console.log('env:sync →', outPath);