You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by se...@apache.org on 2020/09/13 08:03:06 UTC

[incubator-nlpcraft] branch NLPCRAFT-116 created (now c976538)

This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a change to branch NLPCRAFT-116
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git.


      at c976538  WIP.

This branch includes the following new commits:

     new c976538  WIP.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-nlpcraft] 01/01: WIP.

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-116
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit c9765389491fe60ae3e07a7220702cc34bf941a8
Author: Sergey Kamov <se...@apache.org>
AuthorDate: Sun Sep 13 11:02:52 2020 +0300

    WIP.
---
 nlpcraft/src/main/resources/nlpcraft.conf                  | 11 ++++-------
 .../org/apache/nlpcraft/common/config/NCConfigurable.scala | 14 ++++++++++----
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/nlpcraft/src/main/resources/nlpcraft.conf b/nlpcraft/src/main/resources/nlpcraft.conf
index a30a2c6..72ae0f9 100644
--- a/nlpcraft/src/main/resources/nlpcraft.conf
+++ b/nlpcraft/src/main/resources/nlpcraft.conf
@@ -51,8 +51,7 @@ nlpcraft {
         # NOTE: all built-in trace exporters use "always" sampling that is only suitable
         # for demo or development purposes. For production usage you need to modify the
         # sampling strategy: https://opencensus.io/tracing/sampling/
-        lifecycle = [
-        ]
+        lifecycle = ""
 
         # Properties for various OpenCensus built-in exporters.
         # All configuration properties are optional unless otherwise specified.
@@ -198,9 +197,8 @@ nlpcraft {
         #
         # See Integrations section (https://nlpcraft.apache.org/integrations.html) for details on how to
         # configure 3rd party token providers.
-        tokenProviders = [
-            nlpcraft # By default - only NLPCraft tokens are enabled and can be used by the user data models.
-        ]
+        # By default - only NLPCraft tokens are enabled and can be used by the user data models.
+        tokenProviders = nlpcraft
 
         # If Spacy is enabled as a token provider (value 'spacy') - defines Spacy proxy URL.
         # spacy.proxy.url=http://localhost:5002
@@ -254,8 +252,7 @@ nlpcraft {
         # - org.apache.nlpcraft.model.opencensus.NCPrometheusExporter (stats)
         # - org.apache.nlpcraft.model.opencensus.NCStackdriverTraceExporter (traces)
         # - org.apache.nlpcraft.model.opencensus.NCStackdriverStatsExporter (stats)
-        lifecycle = [
-        ]
+        lifecycle = ""
 
         # Properties for built-in OpenCensus exporters.
         # All configuration properties are optional unless otherwise specified.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
index 934d9ae..652b49e 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
@@ -234,23 +234,29 @@ trait NCConfigurable {
 
     /**
       * Gets mandatory configuration property.
+      * Note that processed parameter is CSV single string.
       *
       * @param name Full configuration property path (name).
       */
     def getStringList(name: String): Seq[String] = {
         checkMandatory(name)
 
-        hocon.getStringList(name).asScala
+        parseCsv(hocon.getString(name))
     }
 
     /**
       * Gets optional configuration property.
+      * Note that processed parameter is CSV single string.
       *
       * @param name Full configuration property path (name).
       */
-    def getStringListOpt(name: String): Option[Seq[String]] =
-        if (!hocon.hasPath(name)) None else Some(hocon.getStringList(name).asScala)
+    def getStringListOpt(name: String): Option[Seq[String]] = if (!hocon.hasPath(name)) None else Some(getStringList(name))
 
+    /**
+      *
+      * @param s
+      */
+    private def parseCsv(s: String): Seq[String] = s.split(",").map(_.trim).filter(_.nonEmpty)
 }
 
 object NCConfigurable extends LazyLogging {
@@ -270,7 +276,7 @@ object NCConfigurable extends LazyLogging {
       *   2. Use environment variables in a form of 'CONFIG_FORCE_x_y_z' to override configuration
       *      property 'x.y.z' from the file.
       * <p>
-      * Examples:
+      * Examples: TODO:
       *   CONFIG_FORCE_nlpcraft_server_rest_host=localhost
       *   CONFIG_FORCE_nlpcraft_server_lifecycle.0=org.apache.nlpcraft.server.lifecycle.opencensus.NCStackdriverTraceExporter
       *   CONFIG_FORCE_nlpcraft_server_lifecycle.1=org.apache.nlpcraft.server.lifecycle.opencensus.NCStackdriverStatsExporter