This repository has been archived on 2019-08-15. You can view files and clone it, but cannot push or open issues or pull requests.
TheThingsNetworkGateway/gateway.js

41 lines
946 B
JavaScript
Raw Permalink Normal View History

2019-01-03 18:16:39 +00:00
#!/usr/bin/env node
2019-01-03 19:57:54 +00:00
2019-01-03 20:01:48 +00:00
import GatewayServer from './GatewayServer.mjs';
2019-01-03 19:57:54 +00:00
2018-12-21 16:25:01 +00:00
const settings = {
2019-01-03 19:52:10 +00:00
spi_device: "/dev/spidev0.0"
2018-12-21 16:25:01 +00:00
};
// Skip the first 2 items - they are node file.js
2019-01-03 20:01:48 +00:00
const extras = [];
2018-12-21 16:25:01 +00:00
for(let i = 2; i < process.argv.length; i++) {
2019-01-03 18:16:39 +00:00
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;
2019-01-03 19:52:10 +00:00
case "--spi-device":
settings.spi_device = process.argv[++i];
break;
2019-01-03 18:16:39 +00:00
}
2018-12-21 16:25:01 +00:00
}
2019-01-03 20:01:48 +00:00
const server = new GatewayServer(settings);
server.start();