Skip to content

Commit ded13cf

Browse files
Hidden password and licence
1 parent 656b0da commit ded13cf

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/main/java/io/kestra/plugin/fasttransfer/FastTransfer.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"targetDatabase: tpch10",
4747
"targetSchema: dbo",
4848
"targetTable: orders2",
49-
"degree: -2",
49+
"degree: 12",
5050
"method: Ntile",
5151
"distributeKeyColumn: o_orderkey",
5252
"loadMode: Truncate",
@@ -186,7 +186,9 @@ public FastTransfer.Output run(RunContext runContext) throws Exception {
186186
boolean executableSet = tempExe.setExecutable(true);
187187

188188
List<String> command = new ArrayList<>();
189+
List<String> commandLog = new ArrayList<>();
189190
command.add(tempExe.getAbsolutePath());
191+
commandLog.add(tempExe.getAbsolutePath());
190192

191193
Map<String, Property<?>> params = new LinkedHashMap<>();
192194
params.put("--sourceconnectiontype", sourceConnectionType);
@@ -223,11 +225,8 @@ public FastTransfer.Output run(RunContext runContext) throws Exception {
223225
params.put("--mapmethod", mapMethod);
224226
params.put("--license", license);
225227

226-
Set<String> booleanParams = Set.of(
227-
"--sourcetrusted",
228-
"--targettrusted",
229-
"--useworktables"
230-
);
228+
Set<String> booleanParams = Set.of("--sourcetrusted","--targettrusted","--useworktables");
229+
Set<String> sensitiveKeys = Set.of("--sourcepassword", "--targetpassword", "--license");
231230

232231
for (Map.Entry<String, Property<?>> entry : params.entrySet()) {
233232
String key = entry.getKey();
@@ -244,16 +243,19 @@ public FastTransfer.Output run(RunContext runContext) throws Exception {
244243
if (booleanParams.contains(key)) {
245244
if (Boolean.parseBoolean(value)) {
246245
command.add(key);
246+
commandLog.add(key);
247247
}
248248
// Si false, on n'ajoute rien (pas de flag)
249249
} else {
250250
// Pour les autres paramètres, on ajoute clé + valeur
251251
command.add(key);
252252
command.add(value);
253+
commandLog.add(key);
254+
commandLog.add(sensitiveKeys.contains(key) ? "*******" : value);
253255
}
254256
}
255257

256-
logger.info("Command to execute: {}", String.join(" ", command));
258+
logger.info("Command to execute: {}", String.join(" ", commandLog));
257259

258260

259261
ProcessBuilder pb = new ProcessBuilder(command);

0 commit comments

Comments
 (0)