Skip to content

Commit

Permalink
Adds a new option to accept the execution environment
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Nov 8, 2023
1 parent 9e9b50f commit ddebaad
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public final class InstallDemoConfiguration {
static boolean initsecurity = false;
static boolean cluster_mode = false;
static boolean skip_updates = true;

static ExecutionEnvironment environment = ExecutionEnvironment.production;
static String SCRIPT_DIR;
static String BASE_DIR;
static String OPENSEARCH_CONF_FILE;
Expand Down Expand Up @@ -85,7 +87,7 @@ private static void readArguments(String[] args) {
// set script execution dir
SCRIPT_DIR = args[0];

for (int i=1; i< args.length; i++) {
for (int i = 1; i < args.length; i++) {
switch (args[i]) {
case "-y":
assumeyes = true;
Expand All @@ -99,6 +101,22 @@ private static void readArguments(String[] args) {
case "-s":
skip_updates = false;
break;
case "-e":
i++;
try {
environment = ExecutionEnvironment.valueOf(args[i]);
} catch (IllegalArgumentException e) {
System.out.println(
"Invalid argument value for execution environment. "
+ "Please provide one of `"
+ ExecutionEnvironment.production
+ "` OR `"
+ ExecutionEnvironment.test
+ "`"
);
System.exit(-1);
}
break;
case "-h":
case "-?":
showHelp();
Expand Down Expand Up @@ -732,3 +750,8 @@ public String getContent() {
return content;
}
}

enum ExecutionEnvironment {
production,
test;
}

0 comments on commit ddebaad

Please sign in to comment.