23 lines
527 B
JavaScript
23 lines
527 B
JavaScript
import { loadEnvFile } from "node:process";
|
|
|
|
try {
|
|
loadEnvFile();
|
|
} catch (error) {
|
|
if (error.code !== "ENOENT") {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export function getConfig() {
|
|
const port = Number.parseInt(process.env.MACMINI_MCP_PORT || "7331", 10);
|
|
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
throw new Error("MACMINI_MCP_PORT must be an integer between 1 and 65535.");
|
|
}
|
|
|
|
return {
|
|
host: process.env.MACMINI_MCP_HOST || "127.0.0.1",
|
|
port,
|
|
token: process.env.MACMINI_MCP_TOKEN || "",
|
|
};
|
|
}
|