Skip to content

Commit

Permalink
added property to set port, default value 2612
Browse files Browse the repository at this point in the history
  • Loading branch information
cjayswal committed Oct 3, 2022
1 parent cdad595 commit b8755af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/com/qmetry/qaf/automation/tools/RepoEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ public class RepoEditor {
* @param args
*/
public static void main(String[] args) {
final HttpServer server = createServer();
int port = ConfigurationManager.getBundle().getInt("repoeditor.server.port",2612);
final HttpServer server = createServer(port);
try {
server.start();
System.out.println("server started on port: " + port);
System.out.println("type \"exit\" to stop server.");

try (Scanner s = new Scanner(System.in)) {
s.next("exit");
}
Expand All @@ -68,8 +72,8 @@ public static void main(String[] args) {
}

@SuppressWarnings("unchecked")
private static HttpServer createServer() {
HttpServer server = ServerBootstrap.bootstrap().setListenerPort(8080).register("/", (req, res, c) -> {
private static HttpServer createServer(int port) {
HttpServer server = ServerBootstrap.bootstrap().setListenerPort(port).register("/", (req, res, c) -> {
res.setEntity(new FileEntity(new File("dashboard.htm"), ContentType.TEXT_HTML));
}).register("/browse", (req, res, c) -> {
res.setEntity(new StringEntity(browse("."), ContentType.TEXT_HTML));
Expand Down

0 comments on commit b8755af

Please sign in to comment.