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

support aliyun ecs role #964

Merged
merged 2 commits into from
Mar 27, 2019
Merged
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
2 changes: 2 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/PropertyKeyConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class PropertyKeyConst {

public final static String SECRET_KEY = "secretKey";

public final static String RAM_ROLE_NAME = "ramRoleName";

public final static String SERVER_ADDR = "serverAddr";

public final static String CONTEXT_PATH = "contextPath";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ public String call() throws Exception {
}

private void initAkSk(Properties properties) {
String ramRoleName = properties.getProperty(PropertyKeyConst.RAM_ROLE_NAME);
if (!StringUtils.isBlank(ramRoleName)) {
STSConfig.getInstance().setRamRoleName(ramRoleName);
}

String ak = properties.getProperty(PropertyKeyConst.ACCESS_KEY);
if (StringUtils.isBlank(ak)) {
accessKey = SpasAdapter.getAk();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@SuppressWarnings("PMD.ClassNamingShouldBeCamelRule")
public class STSConfig {
private static final String RAM_SECURITY_CREDENTIALS_URL
= "";
= "http://100.100.100.200/latest/meta-data/ram/security-credentials/";
private String ramRoleName;
/**
* STS 临时凭证有效期剩余多少时开始刷新(允许本地时间比 STS 服务时间最多慢多久)
Expand Down