iota-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonyfaust...@apache.org
Subject [7/8] incubator-iota git commit: Refactored the code and moved the config to the util.scala
Date Wed, 19 Oct 2016 18:44:06 GMT
Refactored the code and moved the config to the util.scala


Project: http://git-wip-us.apache.org/repos/asf/incubator-iota/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-iota/commit/b746c388
Tree: http://git-wip-us.apache.org/repos/asf/incubator-iota/tree/b746c388
Diff: http://git-wip-us.apache.org/repos/asf/incubator-iota/diff/b746c388

Branch: refs/heads/master
Commit: b746c38803dc5c5d830dc67462018981e60e8bf9
Parents: 17c643c
Author: Shivansh <shiv4nsh@gmail.com>
Authored: Wed Oct 12 07:55:05 2016 +0530
Committer: Shivansh <shiv4nsh@gmail.com>
Committed: Wed Oct 12 07:55:05 2016 +0530

----------------------------------------------------------------------
 fey-core/src/main/resources/application.conf                | 6 +++---
 .../src/main/scala/org/apache/iota/fey/Application.scala    | 8 --------
 .../src/main/scala/org/apache/iota/fey/FeyUIService.scala   | 9 ++++-----
 fey-core/src/main/scala/org/apache/iota/fey/Utils.scala     | 7 +++++--
 4 files changed, 12 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/b746c388/fey-core/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/fey-core/src/main/resources/application.conf b/fey-core/src/main/resources/application.conf
index 9f5bce3..e732880 100644
--- a/fey-core/src/main/resources/application.conf
+++ b/fey-core/src/main/resources/application.conf
@@ -93,7 +93,8 @@ fey-global-configuration{
     enable = true,
     type = "COMPLETE"
   }
-
+  port = 16666
+  urlPath = "127.0.0.1"
 }
 
 // Fey akka configuration. Can not be overwritten by user
@@ -110,7 +111,6 @@ akka {
 }
 
 //Configuration for rest Api .
-port = 16666
-urlPath = "127.0.0.1"
+
 play.crypto.secret = "apacheiota"
 play.crypto.secret = ${?APPLICATION_SECRET}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/b746c388/fey-core/src/main/scala/org/apache/iota/fey/Application.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/Application.scala b/fey-core/src/main/scala/org/apache/iota/fey/Application.scala
index 11c8cd2..34bbc29 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/Application.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/Application.scala
@@ -18,13 +18,7 @@
 package org.apache.iota.fey
 
 import akka.actor.{ActorSystem, Props}
-import akka.io.IO
-import akka.pattern.ask
-import akka.util.Timeout
 import com.typesafe.config.ConfigFactory
-import spray.can.Http
-
-import scala.concurrent.duration._
 
 object Application extends App {
 
@@ -40,8 +34,6 @@ object FEY_SYSTEM{
 
 object SYSTEM_ACTORS{
 
-  import FEY_SYSTEM._
-
   FEY_CORE_ACTOR
 
   FEY_CORE_ACTOR.actorRef ! FeyCore.START

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/b746c388/fey-core/src/main/scala/org/apache/iota/fey/FeyUIService.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/FeyUIService.scala b/fey-core/src/main/scala/org/apache/iota/fey/FeyUIService.scala
index 6fa7a3c..cb48192 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/FeyUIService.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/FeyUIService.scala
@@ -17,7 +17,6 @@
 
 package org.apache.iota.fey
 
-import com.typesafe.config.ConfigFactory
 import org.apache.iota.fey.FeyCore.JSON_TREE
 import play.api.BuiltInComponents
 import play.api.http.DefaultHttpErrorHandler
@@ -26,14 +25,14 @@ import play.api.mvc._
 import play.api.routing.Router
 import play.api.routing.sird._
 import play.core.server._
+import CONFIG._
 
 import scala.concurrent.Future
 
 object FeyUIService {
-  val config = ConfigFactory.load()
-  val port = config.getInt("port")
-  val urlPath = config.getString("urlPath")
-  val components = new FeyUIService(urlPath, port)
+
+
+  val components = new FeyUIService(URL_PATH, PORT)
   val server = components.server
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/b746c388/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala b/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala
index d4f3210..8ac18cf 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala
@@ -220,12 +220,13 @@ object CONFIG{
   var CUSTOM_DISPATCHERS: ConfigValue = null
   var MONITORING_ENABLED: Boolean = true
   var MONITORING_TYPE: String = "COMPLETE"
+  var PORT = 8080
+  var URL_PATH = "localhost"
 
   def loadUserConfiguration(path: String) : Unit = {
-
     val app = {
       if(path != "" && Files.exists(Paths.get(path))) {
-          ConfigFactory.parseFile(new File(path)).withFallback(ConfigFactory.load())
+        ConfigFactory.parseFile(new File(path)).withFallback(ConfigFactory.load())
       }else {
           log.info("Using Fey Default Configuration")
           log.warn(s"No user configuration defined. Check if your configuration path $path
is right.")
@@ -246,6 +247,8 @@ object CONFIG{
     CUSTOM_DISPATCHERS = app.getValue("custom-dispatchers")
     MONITORING_ENABLED = app.getBoolean("monitoring.enable")
     MONITORING_TYPE = app.getString("monitoring.type").toUpperCase()
+    PORT = app.getInt("port")
+    URL_PATH = app.getString("urlPath")
 
     setLogbackConfiguration()
   }


Mime
View raw message