forked from unimatrix/web
8 lines
594 B
JavaScript
8 lines
594 B
JavaScript
export function imperialRaidEnvironment(payload){
|
|
const lines=payload.split(/(?<=\n)/),matches=[];
|
|
for(let i=0;i<lines.length;i++)if(/^\s*(?:export\s+)?IMPERIAL_RAIDS_ENABLED\s*=/.test(lines[i]))matches.push(i);
|
|
if(matches.length>1)throw Error('Duplicate Imperial raid activation setting requires review');
|
|
if(matches.length)lines[matches[0]]='IMPERIAL_RAIDS_ENABLED=true'+(lines[matches[0]].endsWith('\r\n')?'\r\n':lines[matches[0]].endsWith('\n')?'\n':'');
|
|
else{if(payload&&!payload.endsWith('\n'))lines.push('\n');lines.push('IMPERIAL_RAIDS_ENABLED=true\n');}
|
|
return lines.join('');
|
|
}
|

Staff