parent
15a5bf9d03
commit
0d3edd0a93
@ -1,26 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
import toml from '@iarna/toml';
|
||||
|
||||
import c from './container.mjs';
|
||||
import apply_settings from './Helpers/apply_settings.mjs';
|
||||
import apply_settings from '../Helpers/apply_settings.mjs';
|
||||
|
||||
const root_dir = path.dirname(process.argv[1]);
|
||||
|
||||
let filename_default = "../settings.default.toml",
|
||||
filename_custom = "../../settings.toml";
|
||||
let filename_default = path.resolve(root_dir, "./settings.default.toml"),
|
||||
filename_custom = path.resolve(root_dir, "../settings.toml");
|
||||
|
||||
if(!fs.existsSync(filename_custom))
|
||||
fs.writeFileSync(filename_custom, `# Custom settings file. This file overrides server/settings.default.toml - refer there of example of settings you can override.\n\n`);
|
||||
|
||||
let settings = toml.parse(fs.readFileSync(filename_default, "utf-8")),
|
||||
settings_override = toml.parse(fs.readFileSync("../../settings.custom.toml", "utf-8"));
|
||||
settings_override = toml.parse(fs.readFileSync(filename_custom, "utf-8"));
|
||||
|
||||
apply_settings(settings, settings_override);
|
||||
|
||||
c.register({
|
||||
settings: a.asValue(settings)
|
||||
});
|
||||
|
||||
export default settings;
|
||||
|
@ -1,27 +1,30 @@
|
||||
import path from 'path';
|
||||
|
||||
import ansi from './Helpers/Ansi.mjs';
|
||||
import c from './bootstrap/container.mjs';
|
||||
|
||||
const a = c.resolve("ansi");
|
||||
|
||||
export default function(settings) {
|
||||
|
||||
console.log(`${settings.program_name}, ${settings.version}
|
||||
${ansi.locol}By Starbeamrainbowlabs${ansi.reset}
|
||||
${a.locol}By Starbeamrainbowlabs${a.reset}
|
||||
|
||||
${ansi.hicol}This program ${settings.description}.${ansi.reset}
|
||||
${a.hicol}This program ${settings.description}.${a.reset}
|
||||
|
||||
${ansi.fblue}${ansi.hicol}Usage:${ansi.reset}
|
||||
${a.fblue}${a.hicol}Usage:${a.reset}
|
||||
node --experimental-modules ${path.relative(process.cwd(), process.argv[1])} {subcommand} {options}
|
||||
|
||||
${ansi.fblue}${ansi.hicol}Subcommands:${ansi.reset}
|
||||
${ansi.fyellow}ttn-app-server${ansi.reset} Starts the thing network application server
|
||||
${ansi.fyellow}process-data${ansi.reset} Consolidates collected data from the IoT device and the TTN app server
|
||||
${ansi.fyellow}train-ai${ansi.reset} Trains the AI on the consolidated data
|
||||
${ansi.fyellow}serve-map${ansi.reset} Serves the final output map using the trained AI
|
||||
${a.fblue}${a.hicol}Subcommands:${a.reset}
|
||||
${a.fyellow}ttn-app-server${a.reset} Starts the thing network application server
|
||||
${a.fyellow}process-data${a.reset} Consolidates collected data from the IoT device and the TTN app server
|
||||
${a.fyellow}train-ai${a.reset} Trains the AI on the consolidated data
|
||||
${a.fyellow}serve-map${a.reset} Serves the final output map using the trained AI
|
||||
|
||||
${ansi.fblue}${ansi.hicol}Options:${ansi.reset}
|
||||
${ansi.fyellow}-h --help ${ansi.reset}Show this message
|
||||
${ansi.fyellow}-v --version ${ansi.reset}Show the version of this program
|
||||
${a.fblue}${a.hicol}Options:${a.reset}
|
||||
${a.fyellow}-h --help ${a.reset}Show this message
|
||||
${a.fyellow}-v --version ${a.reset}Show the version of this program
|
||||
|
||||
${ansi.fblue}${ansi.hicol}Environment Variables:${ansi.reset}
|
||||
${a.fblue}${a.hicol}Environment Variables:${a.reset}
|
||||
(none yet)
|
||||
`);
|
||||
};
|
||||
|
@ -0,0 +1,2 @@
|
||||
# Custom settings file. This file overrides server/settings.default.toml - refer there of example of settings you can override.
|
||||
|
Loading…
Reference in new issue