mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:17:09 +00:00
Props.getInt replaced with APIUtil.getPropsAsIntValue
This commit is contained in:
parent
c598ec0e97
commit
ddeaba1eba
@ -2122,8 +2122,11 @@ Versions are groups of endpoints in a file
|
||||
def getPropsAsBoolValue(nameOfProperty: String, defaultValue: Boolean): Boolean = {
|
||||
getPropsValue(nameOfProperty) map(toBoolean) openOr(defaultValue)
|
||||
}
|
||||
def getPropsAsIntValue(nameOfProperty: String): Box[Int] = {
|
||||
getPropsValue(nameOfProperty) map(toInt)
|
||||
}
|
||||
def getPropsAsIntValue(nameOfProperty: String, defaultValue: Int): Int = {
|
||||
getPropsValue(nameOfProperty) map(toInt) openOr(defaultValue)
|
||||
getPropsAsIntValue(nameOfProperty) openOr(defaultValue)
|
||||
}
|
||||
def getPropsAsLongValue(nameOfProperty: String, defaultValue: Long): Long = {
|
||||
getPropsValue(nameOfProperty) flatMap(asLong) openOr(defaultValue)
|
||||
|
||||
@ -483,7 +483,7 @@ object KafkaMappedConnector extends Connector with KafkaHelper with MdcLoggable
|
||||
spawn{
|
||||
val useMessageQueue = APIUtil.getPropsAsBoolValue("messageQueue.updateBankAccountsTransaction", false)
|
||||
val outDatedTransactions = Box!!account.lastUpdate match {
|
||||
case Full(l) => now after time(l.getTime + hours(Props.getInt("messageQueue.updateTransactionsInterval", 1)))
|
||||
case Full(l) => now after time(l.getTime + hours(APIUtil.getPropsAsIntValue("messageQueue.updateTransactionsInterval", 1)))
|
||||
case _ => true
|
||||
}
|
||||
//if(outDatedTransactions && useMessageQueue) {
|
||||
|
||||
@ -668,7 +668,7 @@ object KafkaMappedConnector_JVMcompatible extends Connector with KafkaHelper wit
|
||||
spawn{
|
||||
val useMessageQueue = APIUtil.getPropsAsBoolValue("messageQueue.updateBankAccountsTransaction", false)
|
||||
val outDatedTransactions = Box!!account.lastUpdate match {
|
||||
case Full(l) => now after time(l.getTime + hours(Props.getInt("messageQueue.updateTransactionsInterval", 1)))
|
||||
case Full(l) => now after time(l.getTime + hours(APIUtil.getPropsAsIntValue("messageQueue.updateTransactionsInterval", 1)))
|
||||
case _ => true
|
||||
}
|
||||
//if(outDatedTransactions && useMessageQueue) {
|
||||
|
||||
@ -267,7 +267,7 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
Future{
|
||||
val useMessageQueue = APIUtil.getPropsAsBoolValue("messageQueue.updateBankAccountsTransaction", false)
|
||||
val outDatedTransactions = Box!!account.accountLastUpdate.get match {
|
||||
case Full(l) => now after time(l.getTime + hours(Props.getInt("messageQueue.updateTransactionsInterval", 1)))
|
||||
case Full(l) => now after time(l.getTime + hours(APIUtil.getPropsAsIntValue("messageQueue.updateTransactionsInterval", 1)))
|
||||
case _ => true
|
||||
}
|
||||
if(outDatedTransactions && useMessageQueue) {
|
||||
|
||||
@ -340,7 +340,7 @@ private object LocalRecordConnector extends Connector with MdcLoggable {
|
||||
private def updateAccountTransactions(bank: HostedBank, account: Account): Unit = {
|
||||
Future {
|
||||
val useMessageQueue = APIUtil.getPropsAsBoolValue("messageQueue.updateBankAccountsTransaction", false)
|
||||
val outDatedTransactions = now after time(account.accountLastUpdate.get.getTime + hours(Props.getInt("messageQueue.updateTransactionsInterval", 1)))
|
||||
val outDatedTransactions = now after time(account.accountLastUpdate.get.getTime + hours(APIUtil.getPropsAsIntValue("messageQueue.updateTransactionsInterval", 1)))
|
||||
if(outDatedTransactions && useMessageQueue) {
|
||||
UpdatesRequestSender.sendMsg(UpdateBankAccount(account.accountNumber.get, bank.national_identifier.get))
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ object ObpJvmMappedConnector extends Connector with MdcLoggable {
|
||||
spawn{
|
||||
val useMessageQueue = APIUtil.getPropsAsBoolValue("messageQueue.updateBankAccountsTransaction", false)
|
||||
val outDatedTransactions = Box!!account.lastUpdate match {
|
||||
case Full(l) => now after time(l.getTime + hours(Props.getInt("messageQueue.updateTransactionsInterval", 1)))
|
||||
case Full(l) => now after time(l.getTime + hours(APIUtil.getPropsAsIntValue("messageQueue.updateTransactionsInterval", 1)))
|
||||
case _ => true
|
||||
}
|
||||
//if(outDatedTransactions && useMessageQueue) {
|
||||
|
||||
@ -2,6 +2,7 @@ package code.kafka
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import net.liftweb.util.Props
|
||||
|
||||
import scala.concurrent.duration.{FiniteDuration, MILLISECONDS}
|
||||
@ -13,7 +14,7 @@ trait KafkaConfig {
|
||||
|
||||
val bootstrapServers = Props.get("kafka.bootstrap_hosts")openOr("localhost:9092")
|
||||
|
||||
val partitions = Props.getInt("kafka.partitions")openOr(10)
|
||||
val partitions = APIUtil.getPropsAsIntValue("kafka.partitions", 10)
|
||||
|
||||
|
||||
val clientId = UUID.randomUUID().toString
|
||||
@ -22,5 +23,5 @@ trait KafkaConfig {
|
||||
val autoOffsetResetConfig = "earliest"
|
||||
val maxWakeups = 50
|
||||
//TODO should be less then container's timeout
|
||||
val completionTimeout = FiniteDuration(Props.getInt("kafka.akka.timeout", 2)*1000 - 450, MILLISECONDS)
|
||||
val completionTimeout = FiniteDuration(APIUtil.getPropsAsIntValue("kafka.akka.timeout", 2)*1000 - 450, MILLISECONDS)
|
||||
}
|
||||
@ -31,6 +31,7 @@ Berlin 13359, Germany
|
||||
*/
|
||||
package code.model.dataAccess
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import code.metadata.narrative.OBPNarrativeInit
|
||||
import code.metadata.wheretags.OBPWhereTagInit
|
||||
import com.mongodb.MongoClient
|
||||
@ -49,7 +50,7 @@ object MongoConfig {
|
||||
|
||||
val srvr = new ServerAddress(
|
||||
Props.get("mongo.host", "localhost"),
|
||||
Props.getInt("mongo.port", 27017)
|
||||
APIUtil.getPropsAsIntValue("mongo.port", 27017)
|
||||
)
|
||||
val defaultDatabase = Props.mode match {
|
||||
case Props.RunModes.Test => "test"
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package code.util
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import net.liftweb.mapper.{MappedString, Mapper}
|
||||
import net.liftweb.util.Props
|
||||
|
||||
@ -12,20 +13,20 @@ class UUIDString [T <: Mapper[T]](override val fieldOwner : T) extends MappedStr
|
||||
|
||||
object UUIDString {
|
||||
// We use 44 as a default because base64 encoding of sha256 is 44 characters long
|
||||
val MaxLength = Props.getInt("uuid_string.length", 44)
|
||||
val MaxLength = APIUtil.getPropsAsIntValue("uuid_string.length", 44)
|
||||
}
|
||||
|
||||
|
||||
class MediumString [T <: Mapper[T]](override val fieldOwner : T) extends MappedString(fieldOwner, MediumString.MaxLength)
|
||||
|
||||
object MediumString {
|
||||
val MaxLength = Props.getInt("medium_string.length", 20)
|
||||
val MaxLength = APIUtil.getPropsAsIntValue("medium_string.length", 20)
|
||||
}
|
||||
|
||||
class AccountIdString [T <: Mapper[T]](override val fieldOwner : T) extends MappedString(fieldOwner, AccountIdString.MaxLength)
|
||||
|
||||
object AccountIdString {
|
||||
val MaxLength = Props.getInt("account_id.length", 64)
|
||||
val MaxLength = APIUtil.getPropsAsIntValue("account_id.length", 64)
|
||||
}
|
||||
|
||||
|
||||
@ -36,5 +37,5 @@ So we can store a time of day without the date e.g. 23:33 - but also go past mid
|
||||
class TwentyFourHourClockString [T <: Mapper[T]](override val fieldOwner : T) extends MappedString(fieldOwner, TwentyFourHourClockString.MaxLength)
|
||||
|
||||
object TwentyFourHourClockString {
|
||||
val MaxLength = Props.getInt("time_string.length", 5)
|
||||
val MaxLength = APIUtil.getPropsAsIntValue("time_string.length", 5)
|
||||
}
|
||||
@ -29,12 +29,13 @@ Berlin 13359, Germany
|
||||
Ayoub Benali: ayoub AT tesobe DOT com
|
||||
*/
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import net.liftweb.util.Props
|
||||
import org.eclipse.jetty.server.Server
|
||||
import org.eclipse.jetty.webapp.WebAppContext
|
||||
|
||||
object RunWebApp extends App {
|
||||
val server = new Server(Props.getInt("dev.port", 8080))
|
||||
val server = new Server(APIUtil.getPropsAsIntValue("dev.port", 8080))
|
||||
|
||||
val context = new WebAppContext()
|
||||
context.setServer(server)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package code
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import org.eclipse.jetty.server.Server
|
||||
import org.eclipse.jetty.webapp.WebAppContext
|
||||
|
||||
@ -7,9 +8,9 @@ object TestServer {
|
||||
import net.liftweb.util.Props
|
||||
|
||||
val host = "localhost"
|
||||
val port = Props.getInt("tests.port",8000)
|
||||
val port = APIUtil.getPropsAsIntValue("tests.port",8000)
|
||||
val externalHost = Props.get("external.hostname")
|
||||
val externalPort = Props.getInt("external.port")
|
||||
val externalPort = APIUtil.getPropsAsIntValue("external.port")
|
||||
val server = new Server(port)
|
||||
|
||||
val context = new WebAppContext()
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package code.setup
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.GatewayLogin
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.APIUtil.OAuth.{Consumer, Token}
|
||||
import code.consumer.Consumers
|
||||
import code.model.TokenType._
|
||||
@ -36,7 +38,7 @@ trait DefaultUsers {
|
||||
lazy val consumer = Consumer(testConsumer.key.get, testConsumer.secret.get)
|
||||
|
||||
// create the access token
|
||||
val expiration = Props.getInt("token_expiration_weeks", 4)
|
||||
val expiration = APIUtil.getPropsAsIntValue("token_expiration_weeks", 4)
|
||||
lazy val tokenDuration = weeks(expiration)
|
||||
|
||||
// Create resource user, need provider
|
||||
|
||||
Loading…
Reference in New Issue
Block a user