Skip to content

Commit

Permalink
adobeGH-213: enhance WorkspaceUtil to also search in evnrionment vari…
Browse files Browse the repository at this point in the history
…ables
  • Loading branch information
nicdard committed Jan 31, 2024
1 parent 2948283 commit 4d3d3ac
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ims/src/main/java/com/adobe/aio/util/WorkspaceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ public static Workspace.Builder getSystemWorkspaceBuilder() {
return Workspace.builder()
.properties(System.getProperties())
.privateKey(privateKey);
} else if (StringUtils.isNoneBlank(
System.getenv(PrivateKeyBuilder.AIO_ENCODED_PKCS_8),
System.getenv(Workspace.API_KEY),
System.getenv(Workspace.WORKSPACE_ID),
System.getenv(Workspace.CLIENT_SECRET),
System.getenv(Workspace.CONSUMER_ORG_ID),
System.getenv(Workspace.CREDENTIAL_ID),
System.getenv(Workspace.IMS_ORG_ID),
System.getenv(Workspace.META_SCOPES),
System.getenv(Workspace.PROJECT_ID),
System.getenv(Workspace.TECHNICAL_ACCOUNT_ID))) {
logger.debug("loading test Workspace from JVM System Properties");
PrivateKey privateKey =
new PrivateKeyBuilder()
.encodedPkcs8Key(System.getenv(PrivateKeyBuilder.AIO_ENCODED_PKCS_8))
.build();
return Workspace.builder().systemEnv().privateKey(privateKey);
} else {
/**
* WARNING: don't push back your workspace secrets to github
Expand Down

0 comments on commit 4d3d3ac

Please sign in to comment.