-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support custom prefixes for S3 and STS #75
Conversation
@Config("s3proxy.hostname") | ||
@ConfigDescription("Hostname to use for REST operations, virtual-host style addressing is only supported if this is set") | ||
@Config("s3proxy.s3.hostname") | ||
@ConfigDescription("Hostname to use for S3 REST operations, virtual-host style addressing is only supported if this is set") | ||
public TrinoS3ProxyConfig setHostName(String hostName) | ||
{ | ||
this.hostName = Optional.ofNullable(hostName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this (and the method) s3Hostname
public static final String S3_PATH = BASE_PATH + "s3"; | ||
public static final String STS_PATH = BASE_PATH + "sts"; | ||
private static final String BASE_PATH = "/api/v1/s3Proxy/"; | ||
public static final String DEFAULT_S3_PATH = BASE_PATH + "s3"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These constants aren't really useful any more. I'd inline them. Let's make BASE_PATH
a config as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was that S3_PATH
and STS_PATH
are now fully independent. BASE_PATH
is only used here for the default.
So someone may have s3proxy.s3.prefix=/s3
and s3proxy.sts.prefix=/sts
and there's no common part to them
Agreed on removing the constants
4ebd242
to
e34a0df
Compare
@@ -52,11 +53,16 @@ public class TrinoS3ProxyServerModule | |||
@Override | |||
protected void setup(Binder binder) | |||
{ | |||
configBinder(binder).bindConfig(SigningControllerConfig.class); | |||
configBinder(binder).bindConfig(TrinoS3ProxyConfig.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildConfigObject
already does the binding so this is redundant
|
||
@Config("s3proxy.s3.prefix") | ||
@ConfigDescription("URL Prefix for S3 operations, optional") | ||
public TrinoS3ProxyConfig setS3Prefix(String s3Prefix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is prefix
the right noun? This is the full path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By prefix
I meant "all S3 operations will be under this path" - meaning all S3 URLs will be this path or something nested within it.
Happy to change it to s3Path
if you think that's more appropriate but I thought prefix was reasonable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Path is better
e34a0df
to
54ae608
Compare
@@ -45,7 +44,7 @@ public TrinoS3ProxyResource(SigningController signingController, TrinoS3ProxyCli | |||
{ | |||
this.signingController = requireNonNull(signingController, "signingController is null"); | |||
this.proxyClient = requireNonNull(proxyClient, "proxyClient is null"); | |||
this.serverHostName = requireNonNull(trinoS3ProxyConfig, "restConfig is null").getHostName(); | |||
this.serverHostName = requireNonNull(trinoS3ProxyConfig, "trinoS3ProxyConfig is null").getS3HostName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't usually check for null on any object we're using - i.e. config objects. You'd get an early NPE anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was debating this one, thanks for clarifying
54ae608
to
a46893d
Compare
@@ -62,8 +60,8 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte | |||
|
|||
TestingTrinoS3ProxyServer trinoS3ProxyServer = builder | |||
.withMockS3Container() | |||
.addModule(binder -> binder.bind(TestingS3ClientProvider.TestingS3ClientConfig.class).in(Scopes.SINGLETON)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in the child binder where TestingS3ClientProvider is bound
a46893d
to
ffe546e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor things to address
ffe546e
to
2ec2f45
Compare
Closes #57