Skip to content

Commit

Permalink
added commands to be able to run new server config from files
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielTavaresA committed Jun 28, 2024
1 parent be8abce commit aac6dab
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ object RuntimeEnvironment {
private val securityParam = "scala.security"
private val dbPathParam = "scala.db"
private val peerListParam = "scala.peerlist"
private val appConfParam = "scala.appConf"
private val dbFolder = "database"
private val testParam = "test"

private lazy val sp = new SystemProperties()
private lazy val confDir: String = getConfDir(cleanParam, configParam)
private lazy val appConfFile = confDir + File.separator + "application.conf"
private lazy val appConfFile = getAppConf

lazy val dbPath: String = getDbDirectory(dbPathParam, dbFolder)
lazy val securityPath: String = getRequiredDirectory(securityParam)
Expand Down Expand Up @@ -101,14 +102,22 @@ object RuntimeEnvironment {
private def getPeerListPath(): String = {
val path = sp(peerListParam)
if (path != null && path.trim.nonEmpty) {
path.trim
confDir + File.separator + path.trim
} else if (isTestMode) {
confDir + File.separator + "server-peers-list-mock.conf"
} else {
confDir + File.separator + "server-peers-list.conf"
}
}

private def getAppConf: String = {
val path = sp(appConfParam)
if path != null && path.trim.nonEmpty then
confDir + File.separator + path.trim
else
confDir + File.separator + "application.conf"
}

private def testMode(testParam: String): Boolean = {
sp(testParam) != null
}
Expand Down

0 comments on commit aac6dab

Please sign in to comment.