(key)
| 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, |