Skip to content

Commit

Permalink
Improve cruiseControlClientConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Valeri <[email protected]>
  • Loading branch information
fvaleri committed Jan 2, 2025
1 parent 5098ce0 commit 3588ceb
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,17 +372,19 @@ private void setStandardSaslConfigs(Map<String, Object> kafkaClientProps) {
* @return Cruise Control client configuration.
*/
public CruiseControlClient.Config cruiseControlClientConfig() {
var sslCertificate = cruiseControlSslEnabled ? getFileContent(cruiseControlCrtFilePath) : null;
var apiUsername = cruiseControlAuthEnabled() ? new String(getFileContent(cruiseControlApiUserPath), StandardCharsets.UTF_8) : null;
var apiPassword = cruiseControlAuthEnabled() ? new String(getFileContent(cruiseControlApiPassPath), StandardCharsets.UTF_8) : null;

return new CruiseControlClient.Config(
cruiseControlHostname,
cruiseControlPort,
cruiseControlRackEnabled,
cruiseControlSslEnabled,
cruiseControlSslEnabled ? getFileContent(cruiseControlCrtFilePath) : null,
cruiseControlAuthEnabled(),
cruiseControlAuthEnabled()
? new String(getFileContent(cruiseControlApiUserPath), StandardCharsets.UTF_8) : null,
cruiseControlAuthEnabled()
? new String(getFileContent(cruiseControlApiPassPath), StandardCharsets.UTF_8) : null
sslCertificate,
cruiseControlAuthEnabled,
apiUsername,
apiPassword
);
}

Expand Down

0 comments on commit 3588ceb

Please sign in to comment.