Skip to content

Commit

Permalink
Allow serving API on another port.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaicode committed Mar 23, 2016
1 parent 57b1633 commit b982863
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ java -jar target/*.jar --loadRelease /my-documents/SnomedCT_RF2Release_INT_20150
java -jar target/*.jar --serve
```

### Run on another port
This is useful for running multiple instances of the tool to serve more releases.
```
java -jar target/*.jar --serve ---server.port=8081
```

## Project Info
This project is not officialy supported by IHTSDO.

Expand Down
29 changes: 16 additions & 13 deletions src/main/java/com/kaicube/snomed/srqs/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,43 @@ public SwaggerSpringMvcPlugin customImplementation() {
.includePatterns("/stats.*", "/concepts.*", "/refsets.*");
}

public static void main(String[] args) throws IOException {
if (args.length > 0) {
final String option = args[0];
public static void main(String[] argsArray) throws IOException {
if (argsArray.length == 0) {
exit("Not enough arguments. " + USEAGE);
}

boolean meaningfulArgumentsFound = false;
for (int i = 0; i < argsArray.length; i++) {
final String option = argsArray[i];
switch (option) {
case "--loadRelease":
maxArgs(2, args);
if (args.length > 1) {
if (argsArray.length > i + 1) {
loadRelease = true;
releasePath = args[1];
releasePath = argsArray[1];
final File file = new File(releasePath);
if (!file.isFile()) {
exit("Is not a file: " + file.getAbsolutePath());
}
meaningfulArgumentsFound = true;
} else {
exit("Please specify RF2 release archive path after the --loadRelease argument.");
}
break;
case "--loadTestData":
maxArgs(1, args);
loadTestData = true;
meaningfulArgumentsFound = true;
break;
case "--serve":
maxArgs(1, args);
serve = true;
break;
default:
exit("Unrecognised option: " + option);
meaningfulArgumentsFound = true;
break;
}
} else {
}
if (!meaningfulArgumentsFound) {
exit("Not enough arguments. " + USEAGE);
}

SpringApplication.run(Application.class, args);
SpringApplication.run(Application.class, argsArray);
}

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

0 comments on commit b982863

Please sign in to comment.