Skip to content

Commit 1a0d361

Browse files
committed
Expose Context key in profile as property and allow override in bookmark.
1 parent 3ca79dc commit 1a0d361

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/src/main/java/ch/cyberduck/core/Profile.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ public Map<String, String> getProperties() {
685685
property -> StringUtils.contains(property, '=') ? substitutor.replace(StringUtils.substringAfter(property, '=')) : StringUtils.EMPTY)));
686686
// In profile as dict
687687
properties.putAll(this.map(PROPERTIES_KEY));
688+
if(null != this.getContext()) {
689+
properties.put(CONTEXT_KEY, this.getContext());
690+
}
688691
return properties;
689692
}
690693

s3/src/main/java/ch/cyberduck/core/s3/S3Session.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import ch.cyberduck.core.LoginCallback;
2828
import ch.cyberduck.core.Path;
2929
import ch.cyberduck.core.PathContainerService;
30+
import ch.cyberduck.core.Profile;
3031
import ch.cyberduck.core.Scheme;
3132
import ch.cyberduck.core.TemporaryAccessTokens;
3233
import ch.cyberduck.core.UrlProvider;
@@ -267,7 +268,7 @@ protected S3CredentialsStrategy configureCredentialsStrategy(final HttpClientBui
267268
if(Scheme.isURL(host.getProtocol().getContext())) {
268269
log.debug("Auto-configure credentials from instance metadata {}", host.getProtocol().getContext());
269270
// Fetch temporary session token from instance metadata
270-
return new AWSSessionCredentialsRetriever(trust, key, host.getProtocol().getContext());
271+
return new AWSSessionCredentialsRetriever(trust, key, preferences.getProperty(Profile.CONTEXT_KEY));
271272
}
272273
}
273274
if(host.getProtocol().isRoleConfigurable()) {

0 commit comments

Comments
 (0)