Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring catalogue - phase I #373

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,32 +89,12 @@ public void start() throws Exception {
if (isSsL) {
LOGGER.debug("Info: Starting HTTPs server");

/* Read the configuration and set the HTTPs server properties. */

keystore = config().getString("keystore");
keystorePassword = config().getString("keystorePassword");

/*
* Default port when ssl is enabled is 8443. If set through config, then that value is taken
*/
port = config().getInteger(PORT) == null ? 8443 : config().getInteger(PORT);

/* Setup the HTTPs server properties, APIs and port. */

serverOptions
.setSsl(true)
.setKeyStoreOptions(new JksOptions().setPath(keystore).setPassword(keystorePassword));
startHttpsServer(serverOptions);

} else {
LOGGER.debug("Info: Starting HTTP server");

/* Setup the HTTP server properties, APIs and port. */

serverOptions.setSsl(false);
/*
* Default port when ssl is disabled is 8080. If set through config, then that value is taken
*/
port = config().getInteger(PORT) == null ? 8080 : config().getInteger(PORT);
startHttpServer(serverOptions);
}
LOGGER.debug("Started HTTP server at port : " + port);

Expand Down Expand Up @@ -144,7 +124,6 @@ public void start() throws Exception {
crudApis.setDbService(dbService);
listApis.setDbService(dbService);
relApis.setDbService(dbService);
// TODO : set db service for Rating APIs
crudApis.setHost(config().getString(HOST));
ratingApis.setHost(config().getString(HOST));
mlayerApis.setHost(config().getString(HOST));
Expand Down Expand Up @@ -667,8 +646,7 @@ public void start() throws Exception {
router
.route(api.getStackRestApis() + "/*")
.subRouter(
new StacRestApi(
router, api, config(), validationService, authService, auditingService)
new StacRestApi(router, api, config(), validationService, authService, auditingService)
.init());

// Start server
Expand All @@ -679,6 +657,34 @@ router, api, config(), validationService, authService, auditingService)
LOGGER.info("API server deployed on :" + serverOptions.getPort());
}

private void startHttpServer(HttpServerOptions serverOptions) {
/* Setup the HTTP server properties, APIs and port. */

serverOptions.setSsl(false);
/*
* Default port when ssl is disabled is 8080. If set through config, then that value is taken
*/
port = config().getInteger(PORT) == null ? 8080 : config().getInteger(PORT);
}

private void startHttpsServer(HttpServerOptions serverOptions) {
/* Read the configuration and set the HTTPs server properties. */

keystore = config().getString("keystore");
keystorePassword = config().getString("keystorePassword");

/*
* Default port when ssl is enabled is 8443. If set through config, then that value is taken
*/
port = config().getInteger(PORT) == null ? 8443 : config().getInteger(PORT);

/* Setup the HTTPs server properties, APIs and port. */

serverOptions
.setSsl(true)
.setKeyStoreOptions(new JksOptions().setPath(keystore).setPassword(keystorePassword));
}

private void printDeployedEndpoints(Router router) {
for (Route route : router.getRoutes()) {
if (route.getPath() != null) {
Expand Down
Loading