kopia lustrzana https://github.com/gaul/s3proxy
Fix path-based GCS credentials
Providing both credential and the credential property used only the latter, which was not expanded when credential is a file. Also expand credential in tests. References #128.pull/124/merge
rodzic
6292d28c9c
commit
eece05f02e
|
@ -214,6 +214,7 @@ public final class Main {
|
||||||
credential = Files.toString(credentialFile,
|
credential = Files.toString(credentialFile,
|
||||||
StandardCharsets.UTF_8);
|
StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
properties.remove(Constants.PROPERTY_CREDENTIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider == null || identity == null || credential == null) {
|
if (provider == null || identity == null || credential == null) {
|
||||||
|
|
|
@ -16,15 +16,18 @@
|
||||||
|
|
||||||
package org.gaul.s3proxy;
|
package org.gaul.s3proxy;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.io.ByteSource;
|
import com.google.common.io.ByteSource;
|
||||||
|
import com.google.common.io.Files;
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
|
@ -147,6 +150,14 @@ final class TestUtils {
|
||||||
Constants.PROPERTY_IDENTITY);
|
Constants.PROPERTY_IDENTITY);
|
||||||
String credential = info.getProperties().getProperty(
|
String credential = info.getProperties().getProperty(
|
||||||
Constants.PROPERTY_CREDENTIAL);
|
Constants.PROPERTY_CREDENTIAL);
|
||||||
|
if (provider.equals("google-cloud-storage")) {
|
||||||
|
File credentialFile = new File(credential);
|
||||||
|
if (credentialFile.exists()) {
|
||||||
|
credential = Files.toString(credentialFile,
|
||||||
|
StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
info.getProperties().remove(Constants.PROPERTY_CREDENTIAL);
|
||||||
|
}
|
||||||
String endpoint = info.getProperties().getProperty(
|
String endpoint = info.getProperties().getProperty(
|
||||||
Constants.PROPERTY_ENDPOINT);
|
Constants.PROPERTY_ENDPOINT);
|
||||||
info.s3Identity = info.getProperties().getProperty(
|
info.s3Identity = info.getProperties().getProperty(
|
||||||
|
|
Ładowanie…
Reference in New Issue