Skip to content

Commit a30948b

Browse files
committed
fix: prevent duplicate warning for missing websocketTopicAuth in ConfigValidator
AdminForth/1859/need-to-show-this-warning-only
1 parent 7545306 commit a30948b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎adminforth/modules/configValidator.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,12 @@ export default class ConfigValidator implements IConfigValidator {
12181218
}
12191219

12201220
if (!newConfig.auth.websocketTopicAuth) {
1221+
let websocketTopicAuthWarned = false;
12211222
newConfig.auth.websocketTopicAuth = async (topic: string, adminUser: AdminUser) => {
1222-
afLogger.warn('websocketTopicAuth is not provided. Public access to websocket topics (except /opentopic) is blocked.');
1223+
if (!websocketTopicAuthWarned) {
1224+
websocketTopicAuthWarned = true;
1225+
afLogger.warn('websocketTopicAuth is not provided. Public access to websocket topics (except /opentopic) is blocked.');
1226+
}
12231227
if (!adminUser) {
12241228
// don't allow anonymous users to subscribe
12251229
return false;

0 commit comments

Comments
 (0)