Fix index.html generation for custom frontend builds

This commit is contained in:
Mononaut 2024-05-14 00:15:36 +00:00
parent 12d212b89f
commit 2ffaeb50df
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -11,6 +11,7 @@ let configContent = {};
let gitCommitHash = ''; let gitCommitHash = '';
let packetJsonVersion = ''; let packetJsonVersion = '';
let customConfig; let customConfig;
let customConfigContent;
try { try {
const rawConfig = fs.readFileSync(CONFIG_FILE_NAME); const rawConfig = fs.readFileSync(CONFIG_FILE_NAME);
@ -25,11 +26,16 @@ try {
} }
if (configContent && configContent.CUSTOMIZATION) { if (configContent && configContent.CUSTOMIZATION) {
customConfig = readConfig(configContent.CUSTOMIZATION); try {
customConfig = readConfig(configContent.CUSTOMIZATION);
customConfigContent = JSON.parse(customConfig);
} catch (e) {
console.log(`failed to load customization config from ${configContent.CUSTOMIZATION}`);
}
} }
const baseModuleName = configContent.BASE_MODULE || 'mempool'; const baseModuleName = configContent.BASE_MODULE || 'mempool';
const customBuildName = (customConfig && configContent.enterprise) ? ('.' + configContent.enterprise) : ''; const customBuildName = (customConfigContent && customConfigContent.enterprise) ? ('.' + customConfigContent.enterprise) : '';
const indexFilePath = 'src/index.' + baseModuleName + customBuildName + '.html'; const indexFilePath = 'src/index.' + baseModuleName + customBuildName + '.html';
try { try {