diff --git a/AGENTS.md b/AGENTS.md index b37c558..e322a39 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -56,6 +56,7 @@ write `mux.HandleFunc("/api/2.0/...")` to emulate OnlyOffice, we write an ## Related +- [`docs/README.md`](docs/README.md) — reference index (file client, ES, SQL, rclone). - [`eSlider/inventar`](https://git.produktor.io/eSlider/inventar) — ASR/ADR (see ASR-0008 Go library module conventions). - [`eSlider/inventar-sync`](https://git.produktor.io/eSlider/inventar-sync) — OnlyOffice → Gitea issue sync, consumes this library. - [`produktor.io/vidarr`](https://git.produktor.io/produktor.io/vidarr) — legacy consumer being migrated from `pkg/onlyoffice` to this module. diff --git a/README.md b/README.md index dfb9f2e..53de82e 100644 --- a/README.md +++ b/README.md @@ -999,9 +999,51 @@ oo projects files list 33 | `ONLYOFFICE_CALENDAR_ID` | Default calendar id used when omitted (default `1`) | | `ONLYOFFICE_PROJECT_ID` | Default project id used when omitted (default `33`) | | `OO_URL`, `OO_USER`, `OO_PASS` | Optional CLI-only aliases for `ONLYOFFICE_*` | +| `ONLYOFFICE_ES_URL` | Elasticsearch base URL (`oo search`, own index); see [`docs/elasticsearch.md`](docs/elasticsearch.md) | +| `ONLYOFFICE_ES_INDEX` | OnlyOffice index (default `files_file`) | +| `ONLYOFFICE_ES_TEXT_INDEX` | Own PDF/scan index (default `oo_docs_text`) | +| `ONLYOFFICE_TENANT` | `tenantId` filter for ES/SQL (empty = all) | +| `ONLYOFFICE_DSN` | Read-only SQL DSN (MySQL or `postgres://`); see [`docs/community-server-db.md`](docs/community-server-db.md) | +| `ONLYOFFICE_PG_DRIVER`, `ONLYOFFICE_PG_TENANT`, `ONLYOFFICE_PG_HOST/_PORT/_USER/_PASSWORD/_DBNAME/_SSLMODE` | SQL store override / DSN by parts (PostgreSQL) | +| `MINIO_ENDPOINT`, `MINIO_BUCKET`, `MINIO_ACCESS_KEY`, `MINIO_SECRET_KEY` | Object-store layout for SQL `Download` | +| `ONLYOFFICE_WEBDAV_URL` | rclone WebDAV sidecar URL (default `http://172.17.0.1:8098/webdav`) | Mail and CRM cleanup are documented in [oo CLI use cases](#oo-cli-use-cases) above. Personal disk inventory / dossier sync lives in the private `oo-workspace` (`oow`) tooling. +## Testing + +```bash +go build ./... && go vet ./... +go test ./... # unit — no network, no vendor mocks +go test -race ./... +go test -tags=integration ./... # live OnlyOffice (skip without creds) +``` + +Unit tests are pure Go (parsers, encoders, conversions). Integration tests +(`//go:build integration`) hit a live instance and **skip** cleanly when the +env is missing, so `go test ./...` stays green offline. New endpoints ship with +an integration test before merge (policy in [`AGENTS.md`](AGENTS.md)). + +Live runs need credentials (`ONLYOFFICE_URL`, `ONLYOFFICE_USER`, +`ONLYOFFICE_PASS`) and, per backend: + +- **Elasticsearch** (`oo search`, own index) — ES lives on `127.0.0.1:9200` + inside the OnlyOffice VM; expose it over SSH + (`-L 9200:127.0.0.1:9200`) and set `ONLYOFFICE_ES_URL` + (see [`docs/elasticsearch.md`](docs/elasticsearch.md)). +- **SQL backend** (`FileClient`, `SQLFileStore`) — MySQL on `127.0.0.1:3306` + in the same VM; tunnel `-L 3306:127.0.0.1:3306`, then set `ONLYOFFICE_DSN` + (see [`docs/community-server-db.md`](docs/community-server-db.md)). + `ONLYOFFICE_PG_TEST_FILE_ID` / `ONLYOFFICE_PG_TEST_FOLDER_ID` select a real + file for the REST cross-check; `MINIO_*` enable the download check. + +### rclone WebDAV mount + +`deploy/docker-compose.rclone-webdav.yml` mounts the Documents tree as a +filesystem (compose, not systemd; container `rclone-webdav`) — read/write like +a normal FS over the `oo-webdav` sidecar. Setup, smoke log and limitations: +[`docs/rclone-webdav.md`](docs/rclone-webdav.md). + ### CI / releases GitHub Actions (pattern from [`eSlider/go-config`](https://github.com/eSlider/go-config)): diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..16ae66f --- /dev/null +++ b/docs/README.md @@ -0,0 +1,25 @@ +--- +type: reference +status: current +related: + - README.md +--- + +# go-onlyoffice — docs + +Индекс справочников. Общее — [README.md](../README.md), правила — [AGENTS.md](../AGENTS.md). + +## Файлы +- [unified-file-client.md](unified-file-client.md) — единый файловый клиент: + `Entry`/`FileStore`/`FileClient`, бэкенды REST/DAV/SQL/ES, env, как добавить + бэкенд. +- [community-server-db.md](community-server-db.md) — read-only SQL-бэкенд + (MySQL/PostgreSQL): схема, SSH-туннель, DSN, MinIO download. +- [elasticsearch.md](elasticsearch.md) — поиск: индекс OnlyOffice `files_file` + и свой `oo_docs_text` (PDF/сканы), туннель. +- [rclone-webdav.md](rclone-webdav.md) — rclone-монтирование Documents + (`deploy/docker-compose.rclone-webdav.yml`), smoke, ограничения. +- [crm-associations.md](crm-associations.md) — правила ассоциаций CRM. + +## Тесты +Команды и туннели — раздел Testing в [README.md](../README.md#testing). diff --git a/docs/unified-file-client.md b/docs/unified-file-client.md index 5547ec1..8a498f2 100644 --- a/docs/unified-file-client.md +++ b/docs/unified-file-client.md @@ -199,5 +199,7 @@ go test ./ -run 'FileStore|Facade|ESText|PG' ## См. также +- [README.md](README.md) — индекс справочников. - [elasticsearch.md](elasticsearch.md) — индекс OnlyOffice и свой `oo_docs_text`. - [community-server-db.md](community-server-db.md) — SQL-стор и схема БД. +- [rclone-webdav.md](rclone-webdav.md) — монтирование Documents как ФС.