From 8e5ada62eab9fa1e6f60eed17ca2f3619ec5d778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Wed, 7 Aug 2019 14:40:07 +0200 Subject: [PATCH] Tweaked the props server_mode --- README.md | 10 +++++----- obp-api/src/main/scala/bootstrap/liftweb/Boot.scala | 10 ++++++---- obp-api/src/main/scala/code/api/util/APIUtil.scala | 5 +++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3cc9c8951..1f0a250fd 100644 --- a/README.md +++ b/README.md @@ -375,15 +375,15 @@ We use jetty8 to run the API in production mode. ## Using OBP-API in different app modes 1) `portal` => OBP-API as a portal i.e. without REST API -2) `backend` => OBP-API as a back-end app i.e. only REST API -3) `multi`=> OBP-API as portal and back-end i.e. REST API and web portal +2) `apis` => OBP-API as a apis app i.e. only REST APIs +3) `apis,portal`=> OBP-API as portal and apis i.e. REST APIs and web portal * Edit your props file(s) to contain one of the next cases: 1) server_mode=portal - 2) server_mode=backend - 3) server_mode=multi - In case is not defined default case is the 3rd one i.e. server_mode=multi + 2) server_mode=apis + 3) server_mode=apis,portal + In case is not defined default case is the 3rd one i.e. server_mode=apis,portal ## Using Akka remote storage diff --git a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala index fefe90903..63e0e1703 100644 --- a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala +++ b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala @@ -303,9 +303,10 @@ class Boot extends MdcLoggable { LiftRules.statelessDispatch.append(ImporterAPI) } - APIUtil.getPropsValue("server_mode", "multi") match { + APIUtil.getPropsValue("server_mode", "apis,portal") match { case mode if mode == "portal" => - case mode if mode == "backend" => enableAPIs + case mode if mode == "apis" => enableAPIs + case mode if mode.contains("apis") && mode.contains("portal") => enableAPIs case _ => enableAPIs } @@ -389,9 +390,10 @@ class Boot extends MdcLoggable { // Build SiteMap - val indexPage = APIUtil.getPropsValue("server_mode", "multi") match { + val indexPage = APIUtil.getPropsValue("server_mode", "apis,portal") match { case mode if mode == "portal" => List(Menu.i("Home") / "index") - case mode if mode == "backend" => List() + case mode if mode == "apis" => List() + case mode if mode.contains("apis") && mode.contains("portal") => List(Menu.i("Home") / "index") case _ => List(Menu.i("Home") / "index") } val sitemap = indexPage ::: List( diff --git a/obp-api/src/main/scala/code/api/util/APIUtil.scala b/obp-api/src/main/scala/code/api/util/APIUtil.scala index 7ab062b2c..84505d611 100644 --- a/obp-api/src/main/scala/code/api/util/APIUtil.scala +++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala @@ -1623,9 +1623,10 @@ Returns a string showed to the developer else false } - APIUtil.getPropsValue("server_mode", "multi") match { + APIUtil.getPropsValue("server_mode", "apis,portal") match { case mode if mode == "portal" => false - case mode if mode == "backend" => checkVersion + case mode if mode == "apis" => checkVersion + case mode if mode.contains("apis") && mode.contains("portal") => checkVersion case _ => checkVersion } }