Browse Source

config: add [allowed_keys] allow_all=yes by default, add [gui] as valid section

- node_config.cpp: add [allowed_keys] allow_all=yes to default config
- config_parser.c: add SECTION_GUI to suppress 'Key outside section' warnings
topo_upd
Evgeny 3 months ago
parent
commit
d83d281fa0
  1. 4
      src/config_parser.c
  2. 3
      tools/chatgui/transport/node_config.cpp

4
src/config_parser.c

@ -49,6 +49,7 @@ typedef enum {
SECTION_TCP_PROXY_SERVER,
SECTION_MSG_TRANSPORT,
SECTION_NETWORK,
SECTION_GUI,
SECTION_NTP
} section_type_t;
@ -765,6 +766,7 @@ static section_type_t parse_section_header(const char *line, char *name, size_t
if (strcasecmp(section, "tcp_proxy_server") == 0) return SECTION_TCP_PROXY_SERVER;
if (strcasecmp(section, "msg_transport") == 0) return SECTION_MSG_TRANSPORT;
if (strcasecmp(section, "ntp") == 0) return SECTION_NTP;
if (strcasecmp(section, "gui") == 0) return SECTION_GUI;
char *colon = strchr(section, ':');
if (!colon) return SECTION_UNKNOWN;
@ -996,6 +998,8 @@ static struct utun_config* parse_config_internal(FILE *fp, const char *filename)
DEBUG_ERROR(DEBUG_CATEGORY_CONFIG, "%s:%d: Unknown ntp option '%s'. Valid: enabled, server, interval", filename, line_num, key);
}
break;
case SECTION_GUI:
break;
default:
DEBUG_WARN(DEBUG_CATEGORY_CONFIG, "%s:%d: Key outside section: %s", filename, line_num, key);
break;

3
tools/chatgui/transport/node_config.cpp

@ -345,6 +345,9 @@ bool NodeConfig::save() {
out << "debug_level=" << (m_debugLevel.isEmpty() ? "info" : m_debugLevel) << "\n";
out << "debug_categories=" << m_debugCategories << "\n\n";
out << "[allowed_keys]\n";
out << "allow_all=yes\n\n";
out << "[ntp]\n";
out << "enabled=yes\n";
out << "server=pool.ntp.org\n";

Loading…
Cancel
Save