Skip to content

Commit a73e3e9

Browse files
committed
add default username
1 parent 142cc43 commit a73e3e9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

connector/src/main/java/io/questdb/kafka/QuestDBSinkConnectorConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static ConfigDef conf() {
5959
.define(DESIGNATED_TIMESTAMP_COLUMN_NAME_CONFIG, Type.STRING, null, Importance.MEDIUM, DESIGNATED_TIMESTAMP_COLUMN_NAME_DOC)
6060
.define(INCLUDE_KEY_CONFIG, Type.BOOLEAN, true, Importance.MEDIUM, INCLUDE_KEY_DOC)
6161
.define(SYMBOL_COLUMNS_CONFIG, Type.STRING, null, Importance.MEDIUM, SYMBOL_COLUMNS_DOC)
62-
.define(USERNAME, Type.STRING, null, Importance.MEDIUM, USERNAME_DOC)
62+
.define(USERNAME, Type.STRING, "admin", Importance.MEDIUM, USERNAME_DOC)
6363
.define(TOKEN, Type.STRING, null, Importance.MEDIUM, TOKEN_DOC)
6464
.define(TLS, Type.BOOLEAN, false, Importance.MEDIUM, TLS_DOC);
6565
}

connector/src/main/java/io/questdb/kafka/QuestDBSinkTask.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@ private Sender createSender() {
5050
if (config.isTls()) {
5151
builder.enableTls();
5252
}
53-
if (config.getUsername() != null) {
54-
if (config.getToken() == null) {
55-
throw new ConnectException("Token is required when username is provided");
53+
if (config.getToken() != null) {
54+
String username = config.getUsername();
55+
if (username == null || username.equals("")) {
56+
throw new ConnectException("Username cannot be empty when using ILP authentication");
5657
}
57-
builder.enableAuth(config.getUsername()).authToken(config.getToken());
58+
builder.enableAuth(username).authToken(config.getToken());
5859
}
5960
Sender rawSender = builder.build();
6061
String symbolColumns = config.getSymbolColumns();

0 commit comments

Comments
 (0)