-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from emqx/refactor-mount-dict-at-runtime
refactor: mount dict files and add at runtime
- Loading branch information
Showing
4 changed files
with
53 additions
and
268 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
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,13 @@ | ||
# Check EMQX Schema Spelling | ||
|
||
`emqx_schema_validate path/to/schema.json` | ||
|
||
# Run in docker | ||
|
||
Mount dict files (.txt suffix) to `/dicts/` dir. | ||
|
||
``` | ||
docker run --rm -v path/to/dicts:/dicts \ | ||
-v path/to/schema.json:/schema.json \ | ||
ghcr.io/emqx/emqx-schema-validate:0.4.0 /scehma.json | ||
``` |
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
for dict in /dicts/*.txt; do | ||
echo "Adding $dict" | ||
cat "$dict" >> org/languagetool/resource/en/hunspell/spelling.txt | ||
done | ||
|
||
ARGS="$*" | ||
|
||
if [ -z "${ARGS}" ]; then | ||
echo "Missing schema file" | ||
exit 1 | ||
fi | ||
|
||
## LT is Web server, start it in the background. | ||
echo "Starting LanguageTool server..." | ||
bash /LanguageTool/start.sh >/dev/null & | ||
|
||
# health-check the server | ||
attempts=0 | ||
limit=10 | ||
while ! curl --fail --data "language=en-US&text=a simple test" http://localhost:8010/v2/check >/dev/null 2>&1; do | ||
attempts=$(( attempts + 1 )) | ||
if [ $attempts -gt $limit ]; then | ||
echo "Failed to start LanguageTool in $limit seconds" | ||
exit 1 | ||
fi | ||
sleep 1 | ||
done | ||
|
||
echo "Checking $ARGS..." | ||
|
||
emqx_schema_validate "$ARGS" |