mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 14:46:49 +00:00
obp in api path is no longer hardcoded but comes from constant via Props
This commit is contained in:
parent
a70389399f
commit
f39e260971
@ -30,7 +30,7 @@ db.url=jdbc:postgresql://localhost:5432/dbname?user=dbusername&password=thepassw
|
||||
#our own remotely accessible URL
|
||||
#this is needed for oauth to work. it's important to access the api over this url, e.g.
|
||||
# if this is 127.0.0.1 don't use localhost to access it.
|
||||
# (this needs to be an URL)
|
||||
# (this needs to be a URL)
|
||||
hostname=http://127.0.0.1:8080
|
||||
|
||||
#this is only useful for running the api locally via RunWebApp
|
||||
@ -38,6 +38,14 @@ hostname=http://127.0.0.1:8080
|
||||
#if you want to change the port when running via the command line, use "mvn -Djetty.port=8089 jetty:run" instead
|
||||
dev.port=8080
|
||||
|
||||
|
||||
#The start of the api path (before the version)
|
||||
#It is *strongly* recommended not to change this - since Apps will be expecting the api at /obp/+version
|
||||
#Including it here so we have a canonical source of the value
|
||||
#This was introduced March 2016, some code might use hardcoded value instead.
|
||||
#Default value is obp (highly recomended)
|
||||
apiPathZero=obp
|
||||
|
||||
#sending mail out
|
||||
#not need in dev mode, but important for production
|
||||
mail.api.consumer.registered.sender.address=no-reply@example.com
|
||||
|
||||
@ -68,7 +68,7 @@ import net.liftweb.sitemap.Loc._
|
||||
import net.liftweb.sitemap._
|
||||
import net.liftweb.util.Helpers._
|
||||
import net.liftweb.util.{Helpers, Schedule, _}
|
||||
|
||||
import code.api.Constant._
|
||||
|
||||
|
||||
/**
|
||||
@ -179,6 +179,7 @@ class Boot extends Loggable{
|
||||
}
|
||||
|
||||
logger.info("running mode: " + runningMode)
|
||||
logger.info(s"ApiPathZero (the bit before version) is $ApiPathZero")
|
||||
|
||||
// where to search snippets
|
||||
LiftRules.addToPackages("code")
|
||||
|
||||
@ -44,6 +44,7 @@ import code.api.OAuthHandshake._
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
import net.liftweb.json.Extraction
|
||||
import net.liftweb.util.Props
|
||||
import code.api.Constant._
|
||||
|
||||
trait APIFailure{
|
||||
val msg : String
|
||||
@ -80,7 +81,8 @@ trait OBPRestHelper extends RestHelper with Loggable {
|
||||
|
||||
val VERSION : String
|
||||
def vPlusVersion = "v" + VERSION
|
||||
def apiPrefix = ("obp" / vPlusVersion).oPrefix(_)
|
||||
|
||||
def apiPrefix = (ApiPathZero / vPlusVersion).oPrefix(_)
|
||||
|
||||
/*
|
||||
An implicit function to convert magically between a Boxed JsonResponse and a JsonResponse
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package code.api.ResourceDocs1_4_0
|
||||
|
||||
import code.api.util.APIUtil.ResourceDoc
|
||||
import code.api.Constant._
|
||||
import net.liftweb.json._
|
||||
import net.liftweb.util.Props
|
||||
|
||||
@ -51,13 +52,15 @@ object SwaggerJSONFactory {
|
||||
|
||||
def createSwaggerResourceDoc(resourceDocList: List[ResourceDoc]): SwaggerResourceDoc = {
|
||||
implicit val formats = DefaultFormats
|
||||
|
||||
val contact = ContactJson("OBP", "https://openbankproject.com/")
|
||||
val appVersion = "v1.4.0"
|
||||
val apiVersion = "v1.4.0"
|
||||
val title = "Open Bank Project API"
|
||||
val description = "An open source API for banks."
|
||||
val info = InfoJson(title, description, contact, appVersion)
|
||||
val info = InfoJson(title, description, contact, apiVersion)
|
||||
// TODO check / improve host, basePath and version
|
||||
val host = Props.get("hostname", "unknown host").replaceFirst("http://", "")
|
||||
val basePath = "/obp/" + appVersion
|
||||
val basePath = s"/$ApiPathZero/" + apiVersion
|
||||
val schemas = List("http")
|
||||
val paths: ListMap[String, Map[String, MethodJson]] = resourceDocList.groupBy(x => x.requestUrl).toSeq.sortBy(x => x._1).map { mrd =>
|
||||
val methods: Map[String, MethodJson] = mrd._2.map(rd =>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user