#!/usr/bin/env node
import {
  DESIRED_RELAY_PATH
} from "./chunk-7RSBFN2G.js";

// src/common/daemon-env.ts
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "fs";
import { dirname } from "path";
function setDesiredDaemonRelay(relayName) {
  const normalized = relayName?.trim();
  if (normalized) {
    mkdirSync(dirname(DESIRED_RELAY_PATH), { recursive: true });
    writeFileSync(DESIRED_RELAY_PATH, `${normalized}
`);
    return;
  }
  try {
    unlinkSync(DESIRED_RELAY_PATH);
  } catch {
  }
}
function readDesiredDaemonRelay() {
  if (!existsSync(DESIRED_RELAY_PATH)) return void 0;
  const value = readFileSync(DESIRED_RELAY_PATH, "utf-8").trim();
  return value || void 0;
}
function daemonRelayArgs(relayName) {
  const selected = relayName?.trim() || readDesiredDaemonRelay();
  return selected ? ["--relay", selected] : [];
}

export {
  setDesiredDaemonRelay,
  daemonRelayArgs
};
//# sourceMappingURL=chunk-3HJM2NFD.js.map