Skip to content

Commit

Permalink
Rely on default credentials providers if not explicitly set
Browse files Browse the repository at this point in the history
  • Loading branch information
Shmuma committed Oct 16, 2023
1 parent 25cb695 commit 11d4634
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public AbstractImportExportQueryGenerator(final ExasolOptions options) {
* @return identifiedBy part of a query
*/
public String getIdentifier() {
// TODO: get credentials from ENV variable or not pass USER and IDENTIFIED BY at all
final String awsAccessKeyId = this.options.get(Option.AWS_ACCESS_KEY_ID.key());
final String awsSecretAccessKey = this.options.get(Option.AWS_SECRET_ACCESS_KEY.key());
return "AT '" + escapeStringLiteral(getBucketURL()) + "'\nUSER '" + escapeStringLiteral(awsAccessKeyId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ private void updateSparkConfigurationForS3(final ExasolOptions options) {
final SparkSession sparkSession = SparkSession.active();
synchronized (sparkSession.sparkContext().hadoopConfiguration()) {
final Configuration conf = sparkSession.sparkContext().hadoopConfiguration();
conf.set("fs.s3a.access.key", options.get(Option.AWS_ACCESS_KEY_ID.key()));
conf.set("fs.s3a.secret.key", options.get(Option.AWS_SECRET_ACCESS_KEY.key()));
if (options.containsKey(Option.AWS_ACCESS_KEY_ID.key())) {
conf.set("fs.s3a.access.key", options.get(Option.AWS_ACCESS_KEY_ID.key()));
conf.set("fs.s3a.secret.key", options.get(Option.AWS_SECRET_ACCESS_KEY.key()));
}
if (options.containsKey(Option.AWS_CREDENTIALS_PROVIDER.key())) {
conf.set("fs.s3a.aws.credentials.provider", options.get(Option.AWS_CREDENTIALS_PROVIDER.key()));
} else {
conf.set("fs.s3a.aws.credentials.provider", "org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider");
}
if (options.containsKey(Option.S3_ENDPOINT_OVERRIDE.key())) {
conf.set("fs.s3a.endpoint", "http://" + options.get(Option.S3_ENDPOINT_OVERRIDE.key()));
Expand Down

0 comments on commit 11d4634

Please sign in to comment.