Skip to content

Commit a708552

Browse files
committed
Readme upd + badge link update
1 parent cbe6c34 commit a708552

File tree

1 file changed

+58
-41
lines changed

1 file changed

+58
-41
lines changed

README.md

Lines changed: 58 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Spellcheck microservice
2+
23
[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/xfenix/spellcheck-microservice?label=version)](https://github.com/xfenix/spellcheck-microservice/releases)
34
[![Docker Pulls](https://img.shields.io/docker/pulls/xfenix/spellcheck-microservice)](https://hub.docker.com/r/xfenix/spellcheck-microservice)
4-
[![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/xfenix/spellcheck-microservice/main/.github/badges/coverage.json)](https://xfenix.github.io/spellcheck-microservice/coverage/)
5+
[![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/xfenix/spellcheck-microservice/main/.github/badges/coverage.json)](https://xfenix.github.io/spellcheck-microservice/)
56
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
67
<a href="https://github.com/psf/black" target="_blank"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
78
[![Imports: isort](https://img.shields.io/badge/imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://timothycrosley.github.io/isort/)
@@ -13,73 +14,89 @@ It runs blazingly fast due to the use of pychant in its kernel, LRU cache usage
1314
Also it supports feature called «user dictionaries» — user can add his own word-exceptions to personal dictionary.
1415

1516
## Quickstart
16-
* `docker run -p 10113:10113 -t --mount source=spellcheck-dicts,target=/data/ xfenix/spellcheck-microservice:4.1.0`
17-
* check http://localhost:10113/docs/ for full REST documentation
18-
* main REST endpoint you will be needed is http://localhost:10113/api/check/ (this will be available without authorization)
17+
18+
- `docker run -p 10113:10113 -t --mount source=spellcheck-dicts,target=/data/ xfenix/spellcheck-microservice:4.1.0`
19+
- check http://localhost:10113/docs/ for full REST documentation
20+
- main REST endpoint you will be needed is http://localhost:10113/api/check/ (this will be available without authorization)
1921

2022
## Configuration
23+
2124
### Config options
25+
2226
You can change config of the service by changing the environment variables. Here is a list of them:
23-
* `SPELLCHECK_SENTRY_DSN` Sentry DSN for integration. Empty field disables integration. Default value is empty string.
24-
* `SPELLCHECK_API_KEY` define api key for users dictionaries mostly. Please, provide, if you want to enable user dictionaries API. Default value is empty string.
25-
* `SPELLCHECK_ENABLE_CORS` enable CORS for all endpoints. In docker container this option is disabled. Default value is `True`.
26-
* `SPELLCHECK_STRUCTURED_LOGGING` enables structured (json) logging. Default value is `True`.
27-
* `SPELLCHECK_WORKERS` define application server workers count. If you plan to use k8s and only scale with replica sets, you might want to reduce this value to `1`. Default value is `8`. Restrictions: `Gt(gt=0)`, `Lt(lt=301)`
28-
* `SPELLCHECK_PORT` binding port. Default value is `10113`. Restrictions: `Gt(gt=1023)`, `Lt(lt=65536)`
29-
* `SPELLCHECK_CACHE_SIZE` define LRU cache size for misspelled word/suggestions cache. Any value less than `1` makes the cache size unlimited, so be careful with this option. Default value is `10000`.
30-
* `SPELLCHECK_API_PREFIX` define all API's URL prefix. Default value is `/api/`.
31-
* `SPELLCHECK_DOCS_URL` define documentation (swagger) URL prefix. Default value is `/docs/`.
32-
* `SPELLCHECK_MAX_SUGGESTIONS` defines how many maximum suggestions for each word will be available. 0 means unlimitied. Default value is `0`. Restrictions: `Ge(ge=0)`
33-
* `SPELLCHECK_DICTIONARIES_PATH` define directory where user dicts is stored. This is inner directory in the docker image, please map it to volume as it shown in the quickstart part of this readme. Default value is `/data`.
34-
* `SPELLCHECK_DICTIONARIES_STORAGE_PROVIDER` define wich engine will store user dictionaries. Default value is `StorageProviders.FILE`.
35-
* `SPELLCHECK_DICTIONARIES_DISABLED` switches off user dictionaries API no matter what. Default value is `False`.
36-
* `SPELLCHECK_USERNAME_MIN_LENGTH` minimum length of username. Default value is `3`.
37-
* `SPELLCHECK_USERNAME_MAX_LENGTH` maximum length of username. Default value is `60`.
38-
* `SPELLCHECK_EXCLUSION_WORDS_STR` String with list of words which will be ignored in /api/check endpoint each request. Example: `'foo, bar'`. Default value is empty string.
27+
28+
- `SPELLCHECK_SENTRY_DSN` Sentry DSN for integration. Empty field disables integration. Default value is empty string.
29+
- `SPELLCHECK_API_KEY` define api key for users dictionaries mostly. Please, provide, if you want to enable user dictionaries API. Default value is empty string.
30+
- `SPELLCHECK_ENABLE_CORS` enable CORS for all endpoints. In docker container this option is disabled. Default value is `True`.
31+
- `SPELLCHECK_STRUCTURED_LOGGING` enables structured (json) logging. Default value is `True`.
32+
- `SPELLCHECK_WORKERS` define application server workers count. If you plan to use k8s and only scale with replica sets, you might want to reduce this value to `1`. Default value is `8`. Restrictions: `Gt(gt=0)`, `Lt(lt=301)`
33+
- `SPELLCHECK_PORT` binding port. Default value is `10113`. Restrictions: `Gt(gt=1023)`, `Lt(lt=65536)`
34+
- `SPELLCHECK_CACHE_SIZE` define LRU cache size for misspelled word/suggestions cache. Any value less than `1` makes the cache size unlimited, so be careful with this option. Default value is `10000`.
35+
- `SPELLCHECK_API_PREFIX` define all API's URL prefix. Default value is `/api/`.
36+
- `SPELLCHECK_DOCS_URL` define documentation (swagger) URL prefix. Default value is `/docs/`.
37+
- `SPELLCHECK_MAX_SUGGESTIONS` defines how many maximum suggestions for each word will be available. 0 means unlimitied. Default value is `0`. Restrictions: `Ge(ge=0)`
38+
- `SPELLCHECK_DICTIONARIES_PATH` define directory where user dicts is stored. This is inner directory in the docker image, please map it to volume as it shown in the quickstart part of this readme. Default value is `/data`.
39+
- `SPELLCHECK_DICTIONARIES_STORAGE_PROVIDER` define wich engine will store user dictionaries. Default value is `StorageProviders.FILE`.
40+
- `SPELLCHECK_DICTIONARIES_DISABLED` switches off user dictionaries API no matter what. Default value is `False`.
41+
- `SPELLCHECK_USERNAME_MIN_LENGTH` minimum length of username. Default value is `3`.
42+
- `SPELLCHECK_USERNAME_MAX_LENGTH` maximum length of username. Default value is `60`.
43+
- `SPELLCHECK_EXCLUSION_WORDS_STR` String with list of words which will be ignored in /api/check endpoint each request. Example: `'foo, bar'`. Default value is empty string.
3944

4045
### Deployment
46+
4147
Note: all docker & docker-compose variants use named volumes to store user dictionaries.
48+
4249
#### Plain docker
50+
4351
`docker run -p 10113:10113 -t --mount source=spellcheck-dicts,target=/data/ xfenix/spellcheck-microservice:4.1.0`
52+
4453
#### Docker-compose
45-
* Save this example configuration as `docker-compose.yml`:
54+
55+
- Save this example configuration as `docker-compose.yml`:
56+
4657
```yml
4758
version: "3.9"
4859
services:
49-
spellcheck:
50-
image: xfenix/spellcheck-microservice:4.1.0
51-
ports:
52-
- "10113:10113"
53-
volumes:
54-
- spellcheck-dicts:/data/
60+
spellcheck:
61+
image: xfenix/spellcheck-microservice:4.1.0
62+
ports:
63+
- "10113:10113"
64+
volumes:
65+
- spellcheck-dicts:/data/
5566

5667
volumes:
57-
spellcheck-dicts:
68+
spellcheck-dicts:
5869
```
59-
* Then run `docker-compose up`
70+
71+
- Then run `docker-compose up`
6072

6173
## Changelog
74+
6275
You cand find it here https://github.com/xfenix/spellcheck-microservice/releases
6376

6477
## Development
78+
6579
### Quickstart
66-
* Clone this repo
67-
* For MacOS X `brew install enchant`
68-
* For Debian/Ubuntu `apt-get install -y enchant-2 hunspell-ru`
69-
* `uv sync --group dev`
70-
* `source .venv/bin/activate`
71-
* Run `touch .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit`
72-
* Paste following contents in file `.git/hooks/pre-commit`:
73-
```sh
74-
uv run make update-readme
75-
git add README.md
76-
```
77-
* Execute `make` command to run local development server
80+
81+
- Clone this repo
82+
- For MacOS X `brew install enchant`
83+
- For Debian/Ubuntu `apt-get install -y enchant-2 hunspell-ru`
84+
- `uv sync --group dev`
85+
- `source .venv/bin/activate`
86+
- Run `touch .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit`
87+
- Paste following contents in file `.git/hooks/pre-commit`:
88+
```sh
89+
uv run make update-readme
90+
git add README.md
91+
```
92+
- Execute `make` command to run local development server
7893

7994
### Notes
95+
8096
Default api-key for local development is `debug` (you will need this to work with user dictionaries API).
8197

8298
Please check [./Makefile](./Makefile) for more details
8399

84100
### Troubleshooting
101+
85102
For MacOS X on Apple Silicon add `PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.dylib` to your `.zprofile`

0 commit comments

Comments
 (0)