mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 01:48:26 +00:00
Remove fulltext recreate-key config value
It's now in the admin routes, protected by the `admin-endpoint.secret`.
This commit is contained in:
@ -13,7 +13,6 @@ docspell.server {
|
|||||||
# Configuration of the full-text search engine.
|
# Configuration of the full-text search engine.
|
||||||
full-text-search {
|
full-text-search {
|
||||||
enabled = true
|
enabled = true
|
||||||
recreate-key = ""
|
|
||||||
solr = {
|
solr = {
|
||||||
url = "http://solr:8983/solr/docspell"
|
url = "http://solr:8983/solr/docspell"
|
||||||
}
|
}
|
||||||
|
@ -117,10 +117,13 @@ docspell.server {
|
|||||||
# installed the app and have access to the system. Normal users
|
# installed the app and have access to the system. Normal users
|
||||||
# should not have access and therefore a secret must be provided in
|
# should not have access and therefore a secret must be provided in
|
||||||
# order to access it.
|
# order to access it.
|
||||||
|
#
|
||||||
|
# This is used for some endpoints, for example:
|
||||||
|
# - re-create complete fulltext index:
|
||||||
|
# curl -XPOST -H'Docspell-Admin-Secret: xyz' http://localhost:7880/api/v1/admin/fts/reIndexAll
|
||||||
admin-endpoint {
|
admin-endpoint {
|
||||||
# The secret. If empty, the endpoint is disabled.
|
# The secret. If empty, the endpoint is disabled.
|
||||||
secret = ""
|
secret = ""
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Configuration of the full-text search engine.
|
# Configuration of the full-text search engine.
|
||||||
@ -132,14 +135,6 @@ docspell.server {
|
|||||||
# Currently the SOLR search platform is supported.
|
# Currently the SOLR search platform is supported.
|
||||||
enabled = false
|
enabled = false
|
||||||
|
|
||||||
# When re-creating the complete index via a REST call, this key
|
|
||||||
# is required. If left empty (the default), recreating the index
|
|
||||||
# is disabled.
|
|
||||||
#
|
|
||||||
# Example curl command:
|
|
||||||
# curl -XPOST http://localhost:7880/api/v1/open/fts/reIndexAll/test123
|
|
||||||
recreate-key = ""
|
|
||||||
|
|
||||||
# Configuration for the SOLR backend.
|
# Configuration for the SOLR backend.
|
||||||
solr = {
|
solr = {
|
||||||
# The URL to solr
|
# The URL to solr
|
||||||
|
@ -59,7 +59,7 @@ object Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case class FullTextSearch(enabled: Boolean, recreateKey: Ident, solr: SolrConfig)
|
case class FullTextSearch(enabled: Boolean, solr: SolrConfig)
|
||||||
|
|
||||||
object FullTextSearch {}
|
object FullTextSearch {}
|
||||||
|
|
||||||
|
@ -40,6 +40,9 @@ let
|
|||||||
header-value = "some-secret";
|
header-value = "some-secret";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
admin-endpoint = {
|
||||||
|
secret = "";
|
||||||
|
};
|
||||||
full-text-search = {
|
full-text-search = {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
solr = {
|
solr = {
|
||||||
@ -49,7 +52,6 @@ let
|
|||||||
def-type = "lucene";
|
def-type = "lucene";
|
||||||
q-op = "OR";
|
q-op = "OR";
|
||||||
};
|
};
|
||||||
recreate-key = "";
|
|
||||||
};
|
};
|
||||||
auth = {
|
auth = {
|
||||||
server-secret = "hex:caffee";
|
server-secret = "hex:caffee";
|
||||||
@ -343,6 +345,20 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
admin-endpoint = mkOption {
|
||||||
|
type = types.submodule({
|
||||||
|
options = {
|
||||||
|
secret = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = defaults.admin-endpoint.secret;
|
||||||
|
description = "The secret used to call admin endpoints.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
default = defaults.admin-endpoint;
|
||||||
|
description = "An endpoint for administration tasks.";
|
||||||
|
};
|
||||||
|
|
||||||
full-text-search = mkOption {
|
full-text-search = mkOption {
|
||||||
type = types.submodule({
|
type = types.submodule({
|
||||||
options = {
|
options = {
|
||||||
@ -394,18 +410,6 @@ in {
|
|||||||
default = defaults.full-text-search.solr;
|
default = defaults.full-text-search.solr;
|
||||||
description = "Configuration for the SOLR backend.";
|
description = "Configuration for the SOLR backend.";
|
||||||
};
|
};
|
||||||
recreate-key = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = defaults.full-text-search.recreate-key;
|
|
||||||
description = ''
|
|
||||||
When re-creating the complete index via a REST call, this key
|
|
||||||
is required. If left empty (the default), recreating the index
|
|
||||||
is disabled.
|
|
||||||
|
|
||||||
Example curl command:
|
|
||||||
curl -XPOST http://localhost:7880/api/v1/open/fts/reIndexAll/test123
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
default = defaults.full-text-search;
|
default = defaults.full-text-search;
|
||||||
|
@ -16,11 +16,14 @@ workflow.
|
|||||||
The "raw" `openapi.yml` specification file can be found
|
The "raw" `openapi.yml` specification file can be found
|
||||||
[here](/openapi/docspell-openapi.yml).
|
[here](/openapi/docspell-openapi.yml).
|
||||||
|
|
||||||
The routes can be divided into protected and unprotected routes. The
|
The routes can be divided into protected, unprotected routes and admin
|
||||||
unprotected, or open routes are at `/open/*` while the protected
|
routes. The unprotected, or open routes are at `/open/*` while the
|
||||||
routes are at `/sec/*`. Open routes don't require authenticated access
|
protected routes are at `/sec/*` and admin routes are at `/admin/*`.
|
||||||
and can be used by any user. The protected routes require an
|
Open routes don't require authenticated access and can be used by any
|
||||||
authenticated user.
|
user. The protected routes require an authenticated user. The admin
|
||||||
|
routes require a special http header with a value from the config
|
||||||
|
file. They are disabled by default, you need to specify a secret in
|
||||||
|
order to enable admin routes.
|
||||||
|
|
||||||
## Authentication
|
## Authentication
|
||||||
|
|
||||||
@ -38,6 +41,26 @@ a "normal" http header. If a cookie header is used, the cookie name
|
|||||||
must be `docspell_auth` and a custom header must be named
|
must be `docspell_auth` and a custom header must be named
|
||||||
`X-Docspell-Auth`.
|
`X-Docspell-Auth`.
|
||||||
|
|
||||||
|
|
||||||
|
## Admin
|
||||||
|
|
||||||
|
There are some endpoints available for adminstration tasks, for
|
||||||
|
example re-creating the complete fulltext index or resetting a
|
||||||
|
password. These endpoints are not available to normal users, but to
|
||||||
|
admins only. Docspell has no special admin users, it simply uses a
|
||||||
|
secret defined in the configuration file. The person who installs
|
||||||
|
docspell is the admin and knows this secret (and may share it) and
|
||||||
|
requests must provide it as a http header `Docspell-Admin-Secret`.
|
||||||
|
|
||||||
|
Example: re-create the fulltext index (over all collectives):
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
$ curl -XPOST -H "Docspell-Admin-Secret: test123" http://localhost:7880/api/v1/admin/fts/reIndexAll
|
||||||
|
```
|
||||||
|
|
||||||
|
To enable these endpoints, you must provide a secret in the
|
||||||
|
[configuration](@/docs/configure/_index.md#admin-endpoint).
|
||||||
|
|
||||||
## Live Api
|
## Live Api
|
||||||
|
|
||||||
Besides the statically generated documentation at this site, the rest
|
Besides the statically generated documentation at this site, the rest
|
||||||
|
@ -73,6 +73,22 @@ H2
|
|||||||
url = "jdbc:h2:///path/to/a/file.db;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;AUTO_SERVER=TRUE"
|
url = "jdbc:h2:///path/to/a/file.db;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;AUTO_SERVER=TRUE"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Admin Endpoint
|
||||||
|
|
||||||
|
The admin endpoint defines some [routes](@/docs/api/intro.md#admin)
|
||||||
|
for adminstration tasks. This is disabled by default and can be
|
||||||
|
enabled by providing a secret:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
...
|
||||||
|
admin-endpoint {
|
||||||
|
secret = "123"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This secret must be provided to all requests to a `/api/v1/admin/`
|
||||||
|
endpoint.
|
||||||
|
|
||||||
|
|
||||||
## Full-Text Search: SOLR
|
## Full-Text Search: SOLR
|
||||||
|
|
||||||
@ -105,27 +121,21 @@ documentation](https://lucene.apache.org/solr/guide/8_4/installing-solr.html).
|
|||||||
That will provide you with the connection url (the last part is the
|
That will provide you with the connection url (the last part is the
|
||||||
core name).
|
core name).
|
||||||
|
|
||||||
While the `full-text-search.solr` options are the same for joex and
|
The `full-text-search.solr` options are the same for joex and the
|
||||||
the restserver, there are some settings that differ. The restserver
|
restserver.
|
||||||
has this additional setting, that may be of interest:
|
|
||||||
|
There is an [admin route](@/docs/api/intro.md#admin) that allows to
|
||||||
|
re-create the entire index (for all collectives). This is possible via
|
||||||
|
a call:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
full-text-search {
|
$ curl -XPOST -H "Docspell-Admin-Secret: test123" http://localhost:7880/api/v1/admin/fts/reIndexAll
|
||||||
recreate-key = "test123"
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This key is required if you want docspell to drop and re-create the
|
Here the `test123` is the key defined with `admin-endpoint.secret`. If
|
||||||
entire index. This is possible via a REST call:
|
it is empty (the default), this call is disabled (all admin routes).
|
||||||
|
Otherwise, the POST request will submit a system task that is executed
|
||||||
``` bash
|
by a joex instance eventually.
|
||||||
$ curl -XPOST http://localhost:7880/api/v1/open/fts/reIndexAll/test123
|
|
||||||
```
|
|
||||||
|
|
||||||
Here the `test123` is the key defined with `recreate-key`. If it is
|
|
||||||
empty (the default), this REST call is disabled. Otherwise, the POST
|
|
||||||
request will submit a system task that is executed by a joex instance
|
|
||||||
eventually.
|
|
||||||
|
|
||||||
Using this endpoint, the index will be re-created. This is sometimes
|
Using this endpoint, the index will be re-created. This is sometimes
|
||||||
necessary, for example if you upgrade SOLR or delete the core to
|
necessary, for example if you upgrade SOLR or delete the core to
|
||||||
|
Reference in New Issue
Block a user