Skip to content

Commit

Permalink
🐛 Only remove --profile arg when in OKTA_ENV_MODE
Browse files Browse the repository at this point in the history
- With oktadev#303, the call to `removeProfileArguments` moved out of only
  OKTA_ENV_MODE. I don't think this is correct since it was specifically
  added in oktadev#185 which added OKTA_ENV_MODE.
- I have also added support for removing `--profile=*` arguments as well
  since that is also a valid use of the `aws` CLI.
  • Loading branch information
douglaswth committed Jul 26, 2019
1 parent 9b3c9b6 commit 8aeb32c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/okta/tools/WithOkta.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public static void main(String[] args) throws Exception {
awsEnvironment.put("AWS_ACCESS_KEY_ID", runResult.accessKeyId);
awsEnvironment.put("AWS_SECRET_ACCESS_KEY", runResult.secretAccessKey);
awsEnvironment.put("AWS_SESSION_TOKEN", runResult.sessionToken);
// Cleanup command line arguments if present
args = removeProfileArguments(args);
}
// Cleanup command line arguments if present
args = removeProfileArguments(args);

if(args.length == 0) {
logger.info("No additional command line arguments provided. Hint: okta-aws <aws cli command>");
Expand All @@ -61,6 +61,8 @@ private static String[] removeProfileArguments(String[] args) {
else if (profileArg) {
// skip the profile argument
profileArg = false;
} else if (arg.startsWith("--profile=")) {
// skip the single argument profile flag
} else {
argsList.add(arg);
}
Expand Down

0 comments on commit 8aeb32c

Please sign in to comment.