-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docker] Optionally connect to a running REST API container (#3)
* Update installation instructions * Change behavior of search when no results found Handle cases where wanting to connect to an existing docker service * Change step name in workflow * Updates to docs * Correct import * Updates to example * Make doc, sentence, and fields hashable * Test property access * Pass token attributes at runtime * Tests for Sentence + convenience methods * Set ENV default for token attributes * Fix for update endpoint * Support for grammars * Add /api/healthcheck endpoint * PR template
- Loading branch information
1 parent
c72fc4e
commit e266cf1
Showing
20 changed files
with
520 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Summary of Changes | ||
|
||
|
||
### Related issues | ||
|
||
Resolves ??? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package ai.lum.odinson.rest.utils | ||
|
||
import ai.lum.common.ConfigFactory | ||
import scala.collection.JavaConverters._ | ||
import com.typesafe.config.{ Config, ConfigRenderOptions, ConfigValueFactory } | ||
import ai.lum.common.ConfigUtils._ | ||
import ai.lum.common.FileUtils._ | ||
import ai.lum.odinson.{ Document => OdinsonDocument, StringField => OdinsonStringField } | ||
import ai.lum.odinson.utils.exceptions.OdinsonException | ||
import com.typesafe.config.Config | ||
import java.io.File | ||
|
||
object OdinsonConfigUtils { | ||
|
||
/** | ||
* Replaces odinson.compiler.allTokenFields with env var's ODINSON_TOKEN_ATTRIBUTES (if set) | ||
* | ||
* @param config | ||
*/ | ||
def injectTokenAttributes(config: Config): Config = { | ||
val ODINSON_TOKEN_ATTRIBUTES = "ODINSON_TOKEN_ATTRIBUTES" | ||
val TARGET_CONFIG_PROPERTY = "odinson.compiler.allTokenFields" | ||
//println(s"Looking for ${ODINSON_TOKEN_ATTRIBUTES}") | ||
//println(config.getValue(TARGET_CONFIG_PROPERTY)) | ||
sys.env.get(ODINSON_TOKEN_ATTRIBUTES) match { | ||
case None => | ||
println(s"${ODINSON_TOKEN_ATTRIBUTES} not set. Using defaults") | ||
config | ||
case Some(envVar) => | ||
val tokenAttributes = envVar.split(",").toList.asJava | ||
//println(s"overriding ${TARGET_CONFIG_PROPERTY} with ${ODINSON_TOKEN_ATTRIBUTES}=${envVar}") | ||
config.withValue( | ||
TARGET_CONFIG_PROPERTY, | ||
ConfigValueFactory.fromIterable(tokenAttributes) | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.