MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / getConfig

Function getConfig

install/install.ts:610–617  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

608 const dbInc = readFileSync('/home/judge/src/web/include/db_info.inc.php', 'utf-8');
609 const l = dbInc.split('\n');
610 function getConfig(key) {
611 const t = l.find((i) => i.includes(`$${key}`))?.split('=', 2)[1].split(';')[0].trim();
612 if (!t) return null;
613 if (t.startsWith('"') && t.endsWith('"')) return t.slice(1, -1);
614 if (t === 'false') return false;
615 if (t === 'true') return true;
616 return +t;
617 }
618 const config = {
619 host: getConfig('DB_HOST'),
620 port: 3306,

Callers 1

StepsFunction · 0.70

Calls 1

findMethod · 0.80

Tested by

no test coverage detected