41 lines
946 B
JavaScript
41 lines
946 B
JavaScript
#!/usr/bin/env node
|
|
|
|
import GatewayServer from './GatewayServer.mjs';
|
|
|
|
const settings = {
|
|
spi_device: "/dev/spidev0.0"
|
|
};
|
|
|
|
// Skip the first 2 items - they are node file.js
|
|
const extras = [];
|
|
for(let i = 2; i < process.argv.length; i++) {
|
|
if(!process.argv[i].startsWith("-")) {
|
|
extras.push(process.argv[i]);
|
|
continue;
|
|
}
|
|
|
|
switch(process.argv[i]) {
|
|
case "-h":
|
|
case "--help":
|
|
console.log("2-way The Things Network LoRa Gateway");
|
|
console.log("---- By Starbeamrainbowlabs ---------");
|
|
console.log();
|
|
console.log("Usage:");
|
|
console.log(" ./gateway.js {options}");
|
|
console.log("");
|
|
console.log("Options:");
|
|
console.log(" -h --help Show this message");
|
|
console.log("");
|
|
console.log("Environment Variables:");
|
|
console.log(" (none yet)");
|
|
return;
|
|
|
|
case "--spi-device":
|
|
settings.spi_device = process.argv[++i];
|
|
break;
|
|
}
|
|
}
|
|
|
|
const server = new GatewayServer(settings);
|
|
server.start();
|