MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / parseArgs

Function parseArgs

scripts/ingress.mjs:40–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38// ═══════════════════════════════════════════════════════════════════════════
39
40function parseArgs() {
41 const args = process.argv.slice(2);
42 const config = {
43 port: 8000,
44 routes: {},
45 defaultBackend: null,
46 runtimeServicesInfo: null,
47 };
48
49 for (let i = 0; i < args.length; i++) {
50 switch (args[i]) {
51 case "-p":
52 case "--port":
53 config.port = parseInt(args[++i], 10);
54 break;
55 case "-r":
56 case "--route":
57 // Format: "/path=http://host:port"
58 const [path, url] = args[++i].split("=");
59 config.routes[path] = url;
60 break;
61 case "-d":
62 case "--default":
63 config.defaultBackend = args[++i];
64 break;
65 case "--runtime-services-info":
66 config.runtimeServicesInfo = args[++i] || null;
67 break;
68 case "-h":
69 case "--help":
70 showHelp();
71 process.exit(0);
72 }
73 }
74
75 return config;
76}
77
78function showHelp() {
79 console.log(`

Callers 3

ingress.mjsFile · 0.70

Calls 1

showHelpFunction · 0.70

Tested by

no test coverage detected