import fs from 'node:fs/promises'; import { randomBytes } from 'node:crypto'; import { fileURLToPath } from 'node:url'; const file = fileURLToPath(new URL('../search/.env', import.meta.url)); try { await fs.writeFile(file, `SEARXNG_SECRET=${randomBytes(32).toString('hex')}\n`, {flag:'wx',mode:0o600}); console.log('Created local search configuration.'); } catch (error) { if (error.code !== 'EEXIST') throw error; }