MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / serializeEnvFile

Function serializeEnvFile

src/setup/env-writer.ts:44–53  ·  view source on GitHub ↗
(vars: Record<string, string>)

Source from the content-addressed store, hash-verified

42
43/** Serialize a key→value map back to env-file text (sorted for stable diffs). */
44export function serializeEnvFile(vars: Record<string, string>): string {
45 const header =
46 '# QodeX API keys — loaded automatically at startup.\n' +
47 '# Managed by `qodex provider add`. You can edit by hand, one KEY=value per line.\n' +
48 '# This file is chmod 600 and is NOT your config.yaml — keep it private, never commit it.\n\n';
49 const lines = Object.keys(vars)
50 .sort()
51 .map(k => `${k}=${vars[k]}`);
52 return header + lines.join('\n') + '\n';
53}
54
55/** Read the current ~/.qodex/.env into a map (empty if absent/unreadable). */
56export async function readEnvFile(): Promise<Record<string, string>> {

Callers 1

setEnvKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected