redacting WIFI_PKEY in log

This commit is contained in:
Patrick Haßel 2024-04-12 10:10:09 +02:00
parent 47d678cd23
commit d23c992595
2 changed files with 10 additions and 2 deletions

View File

@ -68,7 +68,11 @@ void configPutDouble(const char *name, double value) {
void configPrint() {
info("Config:");
for (JsonPair pair: config.as<JsonObject>()) {
info(" - %s: \"%s\"", pair.key().c_str(), pair.value().as<const char *>());
const char *value = pair.value().as<const char *>();
if (strcmp(pair.key().c_str(), "WIFI_PKEY") == 0) {
value = "[***]";
}
info(" - %s: \"%s\"", pair.key().c_str(), value);
}
}

View File

@ -159,7 +159,11 @@ void _setConfigString(const char *name, bool allowEmpty) {
return;
}
configPutString(name, value);
info(R"(Set "%s" to "%s")", name, value);
if (strcmp(name, "WIFI_PKEY") == 0) {
info(R"(Set "%s" to [***])", name);
} else {
info(R"(Set "%s" to "%s")", name, value);
}
}
void _info() {