mirror of https://github.com/webbukkit/dynmap.git
Start S3 rework
This commit is contained in:
parent
d1b95c9ae0
commit
a9e6d7bd21
|
@ -17,11 +17,7 @@ dependencies {
|
||||||
implementation 'org.yaml:snakeyaml:1.23' // DON'T UPDATE - NEWER ONE TRIPS ON WINDOWS ENCODED FILES
|
implementation 'org.yaml:snakeyaml:1.23' // DON'T UPDATE - NEWER ONE TRIPS ON WINDOWS ENCODED FILES
|
||||||
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20180219.1'
|
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20180219.1'
|
||||||
implementation 'org.postgresql:postgresql:42.2.18'
|
implementation 'org.postgresql:postgresql:42.2.18'
|
||||||
implementation 'io.github.linktosriram:s3-lite-core:0.2.0'
|
implementation 'software.amazon.awssdk:s3:2.20.59'
|
||||||
implementation 'io.github.linktosriram:s3-lite-api:0.2.0'
|
|
||||||
implementation 'io.github.linktosriram:s3-lite-http-client-url-connection:0.2.0'
|
|
||||||
implementation 'io.github.linktosriram:s3-lite-http-client-spi:0.2.0'
|
|
||||||
implementation 'io.github.linktosriram:s3-lite-util:0.2.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
@ -56,11 +52,11 @@ shadowJar {
|
||||||
include(dependency('org.eclipse.jetty::'))
|
include(dependency('org.eclipse.jetty::'))
|
||||||
include(dependency('org.eclipse.jetty.orbit:javax.servlet:'))
|
include(dependency('org.eclipse.jetty.orbit:javax.servlet:'))
|
||||||
include(dependency('org.postgresql:postgresql:'))
|
include(dependency('org.postgresql:postgresql:'))
|
||||||
include(dependency('io.github.linktosriram:s3-lite-core:'))
|
include(dependency('us.dynmap:s3-lite-core:'))
|
||||||
include(dependency('io.github.linktosriram:s3-lite-api:'))
|
include(dependency('us.dynmap:s3-lite-api:'))
|
||||||
include(dependency('io.github.linktosriram:s3-lite-http-client-url-connection:'))
|
include(dependency('us.dynmap:s3-lite-http-client-url-connection:'))
|
||||||
include(dependency('io.github.linktosriram:s3-lite-http-client-spi:'))
|
include(dependency('us.dynmap:s3-lite-http-client-spi:'))
|
||||||
include(dependency('io.github.linktosriram:s3-lite-util:'))
|
include(dependency('us.dynmap:s3-lite-util:'))
|
||||||
include(dependency(':DynmapCoreAPI'))
|
include(dependency(':DynmapCoreAPI'))
|
||||||
exclude("META-INF/maven/**")
|
exclude("META-INF/maven/**")
|
||||||
exclude("META-INF/services/**")
|
exclude("META-INF/services/**")
|
||||||
|
|
|
@ -27,23 +27,6 @@ import org.dynmap.storage.MapStorageTileSearchEndCB;
|
||||||
import org.dynmap.utils.BufferInputStream;
|
import org.dynmap.utils.BufferInputStream;
|
||||||
import org.dynmap.utils.BufferOutputStream;
|
import org.dynmap.utils.BufferOutputStream;
|
||||||
|
|
||||||
import io.github.linktosriram.s3lite.api.client.S3Client;
|
|
||||||
import io.github.linktosriram.s3lite.api.exception.NoSuchKeyException;
|
|
||||||
import io.github.linktosriram.s3lite.api.exception.S3Exception;
|
|
||||||
import io.github.linktosriram.s3lite.api.region.Region;
|
|
||||||
import io.github.linktosriram.s3lite.api.request.DeleteObjectRequest;
|
|
||||||
import io.github.linktosriram.s3lite.api.request.GetObjectRequest;
|
|
||||||
import io.github.linktosriram.s3lite.api.request.ListObjectsV2Request;
|
|
||||||
import io.github.linktosriram.s3lite.api.request.PutObjectRequest;
|
|
||||||
import io.github.linktosriram.s3lite.api.response.GetObjectResponse;
|
|
||||||
import io.github.linktosriram.s3lite.api.response.ListObjectsV2Response;
|
|
||||||
import io.github.linktosriram.s3lite.api.response.ResponseBytes;
|
|
||||||
import io.github.linktosriram.s3lite.api.response.S3Object;
|
|
||||||
import io.github.linktosriram.s3lite.core.auth.AwsBasicCredentials;
|
|
||||||
import io.github.linktosriram.s3lite.core.client.DefaultS3ClientBuilder;
|
|
||||||
import io.github.linktosriram.s3lite.http.spi.request.RequestBody;
|
|
||||||
import io.github.linktosriram.s3lite.http.urlconnection.URLConnectionSdkHttpClient;
|
|
||||||
|
|
||||||
public class AWSS3MapStorage extends MapStorage {
|
public class AWSS3MapStorage extends MapStorage {
|
||||||
public class StorageTile extends MapStorageTile {
|
public class StorageTile extends MapStorageTile {
|
||||||
private final String baseKey;
|
private final String baseKey;
|
||||||
|
@ -222,6 +205,7 @@ public class AWSS3MapStorage extends MapStorage {
|
||||||
|
|
||||||
private String bucketname;
|
private String bucketname;
|
||||||
private String region;
|
private String region;
|
||||||
|
private String apiURL; // Custom API URL
|
||||||
private String access_key_id;
|
private String access_key_id;
|
||||||
private String secret_access_key;
|
private String secret_access_key;
|
||||||
private String prefix;
|
private String prefix;
|
||||||
|
@ -249,6 +233,7 @@ public class AWSS3MapStorage extends MapStorage {
|
||||||
// Get our settings
|
// Get our settings
|
||||||
bucketname = core.configuration.getString("storage/bucketname", "dynmap");
|
bucketname = core.configuration.getString("storage/bucketname", "dynmap");
|
||||||
region = core.configuration.getString("storage/region", "us-east-1");
|
region = core.configuration.getString("storage/region", "us-east-1");
|
||||||
|
apiURL = core.configuration.getString("storage/api_url", null);
|
||||||
access_key_id = core.configuration.getString("storage/aws_access_key_id", System.getenv("AWS_ACCESS_KEY_ID"));
|
access_key_id = core.configuration.getString("storage/aws_access_key_id", System.getenv("AWS_ACCESS_KEY_ID"));
|
||||||
secret_access_key = core.configuration.getString("storage/aws_secret_access_key", System.getenv("AWS_SECRET_ACCESS_KEY"));
|
secret_access_key = core.configuration.getString("storage/aws_secret_access_key", System.getenv("AWS_SECRET_ACCESS_KEY"));
|
||||||
prefix = core.configuration.getString("storage/prefix", "");
|
prefix = core.configuration.getString("storage/prefix", "");
|
||||||
|
@ -256,7 +241,14 @@ public class AWSS3MapStorage extends MapStorage {
|
||||||
prefix += '/';
|
prefix += '/';
|
||||||
}
|
}
|
||||||
// Now creste the access client for the S3 service
|
// Now creste the access client for the S3 service
|
||||||
Log.info("Using AWS S3 storage: web site at S3 bucket " + bucketname + " in region " + region);
|
if (apiURL != null) {
|
||||||
|
Region r = Region.getCustom(region, apiURL);
|
||||||
|
Log.info("region=" + r);
|
||||||
|
Log.info("Using S3-compatible storage: web site at S3 bucket " + bucketname + " in region " + region + " via API URL " + apiURL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log.info("Using AWS S3 storage: web site at S3 bucket " + bucketname + " in region " + region);
|
||||||
|
}
|
||||||
S3Client s3 = null;
|
S3Client s3 = null;
|
||||||
try {
|
try {
|
||||||
s3 = getConnection();
|
s3 = getConnection();
|
||||||
|
|
Loading…
Reference in New Issue