Skip to content

Commit

Permalink
fix secrets import (airbytehq#6643)
Browse files Browse the repository at this point in the history
* fix

* fmt
  • Loading branch information
jrhizor authored and schlattk committed Jan 4, 2022
1 parent 29a7e95 commit bcbcb6f
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,21 +494,24 @@ public void replaceAllConfigs(final Map<AirbyteConfig, Stream<?>> configs, final
}));

if (augmentedMap.containsKey(ConfigSchema.SOURCE_CONNECTION)) {
final Stream<JsonNode> augmentedValue = augmentedMap.get(ConfigSchema.SOURCE_CONNECTION)
final Stream<?> augmentedValue = augmentedMap.get(ConfigSchema.SOURCE_CONNECTION)
.map(config -> {
final SourceConnection source = (SourceConnection) config;

if (!sourceDefIdToSpec.containsKey(source.getSourceDefinitionId())) {
throw new RuntimeException(new ConfigNotFoundException(ConfigSchema.STANDARD_SOURCE_DEFINITION, source.getSourceDefinitionId()));
}

return statefulSplitSecrets(source.getWorkspaceId(), source.getConfiguration(), sourceDefIdToSpec.get(source.getSourceDefinitionId()));
final var connectionConfig =
statefulSplitSecrets(source.getWorkspaceId(), source.getConfiguration(), sourceDefIdToSpec.get(source.getSourceDefinitionId()));

return source.withConfiguration(connectionConfig);
});
augmentedMap.put(ConfigSchema.SOURCE_CONNECTION, augmentedValue);
}

if (augmentedMap.containsKey(ConfigSchema.DESTINATION_CONNECTION)) {
final Stream<JsonNode> augmentedValue = augmentedMap.get(ConfigSchema.DESTINATION_CONNECTION)
final Stream<?> augmentedValue = augmentedMap.get(ConfigSchema.DESTINATION_CONNECTION)
.map(config -> {
final DestinationConnection destination = (DestinationConnection) config;

Expand All @@ -517,8 +520,10 @@ public void replaceAllConfigs(final Map<AirbyteConfig, Stream<?>> configs, final
new ConfigNotFoundException(ConfigSchema.STANDARD_DESTINATION_DEFINITION, destination.getDestinationDefinitionId()));
}

return statefulSplitSecrets(destination.getWorkspaceId(), destination.getConfiguration(),
final var connectionConfig = statefulSplitSecrets(destination.getWorkspaceId(), destination.getConfiguration(),
destinationDefIdToSpec.get(destination.getDestinationDefinitionId()));

return destination.withConfiguration(connectionConfig);
});
augmentedMap.put(ConfigSchema.DESTINATION_CONNECTION, augmentedValue);
}
Expand Down

0 comments on commit bcbcb6f

Please sign in to comment.