Skip to content

Commit b982863

Browse files
committed
Allow serving API on another port.
1 parent 57b1633 commit b982863

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ java -jar target/*.jar --loadRelease /my-documents/SnomedCT_RF2Release_INT_20150
6060
java -jar target/*.jar --serve
6161
```
6262

63+
### Run on another port
64+
This is useful for running multiple instances of the tool to serve more releases.
65+
```
66+
java -jar target/*.jar --serve ---server.port=8081
67+
```
68+
6369
## Project Info
6470
This project is not officialy supported by IHTSDO.
6571

src/main/java/com/kaicube/snomed/srqs/Application.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,40 +77,43 @@ public SwaggerSpringMvcPlugin customImplementation() {
7777
.includePatterns("/stats.*", "/concepts.*", "/refsets.*");
7878
}
7979

80-
public static void main(String[] args) throws IOException {
81-
if (args.length > 0) {
82-
final String option = args[0];
80+
public static void main(String[] argsArray) throws IOException {
81+
if (argsArray.length == 0) {
82+
exit("Not enough arguments. " + USEAGE);
83+
}
84+
85+
boolean meaningfulArgumentsFound = false;
86+
for (int i = 0; i < argsArray.length; i++) {
87+
final String option = argsArray[i];
8388
switch (option) {
8489
case "--loadRelease":
85-
maxArgs(2, args);
86-
if (args.length > 1) {
90+
if (argsArray.length > i + 1) {
8791
loadRelease = true;
88-
releasePath = args[1];
92+
releasePath = argsArray[1];
8993
final File file = new File(releasePath);
9094
if (!file.isFile()) {
9195
exit("Is not a file: " + file.getAbsolutePath());
9296
}
97+
meaningfulArgumentsFound = true;
9398
} else {
9499
exit("Please specify RF2 release archive path after the --loadRelease argument.");
95100
}
96101
break;
97102
case "--loadTestData":
98-
maxArgs(1, args);
99103
loadTestData = true;
104+
meaningfulArgumentsFound = true;
100105
break;
101106
case "--serve":
102-
maxArgs(1, args);
103107
serve = true;
104-
break;
105-
default:
106-
exit("Unrecognised option: " + option);
108+
meaningfulArgumentsFound = true;
107109
break;
108110
}
109-
} else {
111+
}
112+
if (!meaningfulArgumentsFound) {
110113
exit("Not enough arguments. " + USEAGE);
111114
}
112115

113-
SpringApplication.run(Application.class, args);
116+
SpringApplication.run(Application.class, argsArray);
114117
}
115118

116119
private static void maxArgs(int max, String[] args) {

0 commit comments

Comments
 (0)