Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for configuration file format #7

Open
synthead opened this issue Dec 17, 2019 · 0 comments
Open

Add documentation for configuration file format #7

synthead opened this issue Dec 17, 2019 · 0 comments

Comments

@synthead
Copy link

nload supports a configuration file, but the format and options are not documented.

The keys can be found here:

nload/src/app.cpp

Lines 58 to 100 in 8f92dc0

// create setting infrastructure
SettingStore::add(Setting("AverageWindow", "Window length for average (s)", STANDARD_AVERAGE_WINDOW));
SettingStore::add(Setting("BarMaxIn", "Max Incoming deflection (kBit/s)", STANDARD_MAX_DEFLECTION));
SettingStore::add(Setting("BarMaxOut", "Max Outgoing deflection (kBit/s)", STANDARD_MAX_DEFLECTION));
SettingStore::add(Setting("DataFormat", "Unit for data numbers", STANDARD_DATA_FORMAT));
SettingStore::add(Setting("Devices", "Devices to show", "all"));
SettingStore::add(Setting("MultipleDevices", "Show multiple devices", STANDARD_HIDE_GRAPHS));
SettingStore::add(Setting("RefreshInterval", "Refresh interval (ms)", STANDARD_REFRESH_INTERVAL));
SettingStore::add(Setting("TrafficFormat", "Unit for traffic numbers", STANDARD_TRAFFIC_FORMAT));
SettingStore::get("AverageWindow").pushFilter(new SettingFilterMin(5));
SettingStore::get("BarMaxIn").pushFilter(new SettingFilterAllowValue("0"));
SettingStore::get("BarMaxIn").pushFilter(new SettingFilterMin(10));
SettingStore::get("BarMaxOut").pushFilter(new SettingFilterAllowValue("0"));
SettingStore::get("BarMaxOut").pushFilter(new SettingFilterMin(10));
SettingStore::get("RefreshInterval").pushFilter(new SettingFilterMin(50));
SettingStore::get("Devices").pushFilter(new SettingFilterDefault("all"));
SettingStore::get("Devices").pushFilter(new SettingFilterExclusive("all"));
map<string, string> valueMapping;
valueMapping[toString(false)] = "[ ]";
valueMapping[toString(true)] = "[x]";
SettingStore::get("MultipleDevices").pushFilter(new SettingFilterMap(valueMapping));
valueMapping.clear();
valueMapping[toString(Statistics::humanReadableBit)] = "Human Readable (Bit)";
valueMapping[toString(Statistics::humanReadableByte)] = "Human Readable (Byte)";
valueMapping[toString(Statistics::bit)] = "Bit";
valueMapping[toString(Statistics::byte)] = "Byte";
valueMapping[toString(Statistics::kiloBit)] = "kBit";
valueMapping[toString(Statistics::kiloByte)] = "kByte";
valueMapping[toString(Statistics::megaBit)] = "MBit";
valueMapping[toString(Statistics::megaByte)] = "MByte";
valueMapping[toString(Statistics::gigaBit)] = "GBit";
valueMapping[toString(Statistics::gigaByte)] = "GByte";
SettingStore::get("TrafficFormat").pushFilter(new SettingFilterMap(valueMapping));
SettingStore::get("DataFormat").pushFilter(new SettingFilterMap(valueMapping));
valueMapping.clear();
// load system and user settings
loadSettings();

...and the configuration can be set using an ini format of key = value, but I was only able to learn this from reading the source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant