Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 support, take 2 #513

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package de.bluecolored.bluemap.common.config.storage;

import de.bluecolored.bluemap.api.debug.DebugDump;
import de.bluecolored.bluemap.core.storage.Compression;
import de.bluecolored.bluemap.core.storage.s3.S3StorageSettings;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

import java.util.Optional;

@SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal"})
@ConfigSerializable
public class S3Config extends StorageConfig implements S3StorageSettings {
@DebugDump private String endpoint = null;
@DebugDump private String region = "";
@DebugDump private String accessKey = "";
private String secretKey = "";
@DebugDump private String bucket = "";
@DebugDump private Compression compression = Compression.GZIP;

@Override
public Optional<String> getEndpoint() {
return Optional.ofNullable(endpoint);
}

@Override
public String getRegion() {
return region;
}

@Override
public String getAccessKey() {
return accessKey;
}

@Override
public String getSecretKey() {
return secretKey;
}

@Override
public String getBucket() {
return bucket;
}

@Override
public Compression getCompression() {
return compression;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@

import de.bluecolored.bluemap.core.storage.Storage;
import de.bluecolored.bluemap.core.storage.file.FileStorage;
import de.bluecolored.bluemap.core.storage.s3.S3Storage;
import de.bluecolored.bluemap.core.storage.sql.SQLStorage;

public enum StorageType {

FILE (FileConfig.class, FileStorage::new),
SQL (SQLConfig.class, SQLStorage::create);
SQL (SQLConfig.class, SQLStorage::create),
S3 (S3Config.class, S3Storage::new);

private final Class<? extends StorageConfig> configType;
private final StorageFactory<? extends StorageConfig> storageFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## ##
## BlueMap ##
## Storage-Config ##
## ##

# The storage-type of this storage.
# Depending on this setting, different config-entries are allowed/expected in this config file.
# Don't change this value! (If you want a different storage-type, check out the other example-configs)
storage-type: S3

# This is the S3 endpoint that bluemap will use.
# If you're using a third-party S3 compatible provider,
# uncomment this and set it to your provider's S3 endpoint URL.
#endpoint: "https://s3.us-west-004.backblazeb2.com"

# This is the S3 region that bluemap will use.
# Set this to the AWS region of your S3 bucket.
region: "us-east-1"

# The S3 credentials that bluemap will use.
access-key: "changeme"
secret-key: "changeme"

# The S3 bucket name.
bucket: "bluemap"

# The compression-type that bluemap will use to compress generated map-data.
# Available compression-types are:
# - GZIP
# - NONE
# The default is: GZIP
compression: GZIP
2 changes: 2 additions & 0 deletions BlueMapCore/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ dependencies {
api ("org.apache.commons:commons-dbcp2:2.9.0")
api ("io.airlift:aircompressor:0.24")
api ("org.lz4:lz4-java:1.8.0")
api ("com.github.vgskye.s3-lite:core:4a9e099bf8")
api ("com.github.vgskye.s3-lite:http-client-url-connection:4a9e099bf8")

api ("de.bluecolored.bluemap.api:BlueMapAPI")

Expand Down
Loading
Loading