More readme & config doc fixes

This commit is contained in:
Aode (Lion) 2022-04-03 19:26:42 -05:00
parent 7e26e7281a
commit d4c5158e57
2 changed files with 8 additions and 20 deletions

View file

@ -328,17 +328,14 @@ pict-rs offers the following endpoints:
The following endpoints are protected by an API key via the `X-Api-Token` header, and are disabled The following endpoints are protected by an API key via the `X-Api-Token` header, and are disabled
unless the `--api-key` option is passed to the binary or the PICTRS_API_KEY environment variable is unless the `--api-key` option is passed to the binary or the PICTRS_SERVER__API_KEY environment variable is
set. set.
A secure API key can be generated by any password generator. A secure API key can be generated by any password generator.
- `POST /internal/import` for uploading an image while preserving the filename. This should not be - `POST /internal/import` for uploading an image while preserving the filename as the first alias.
exposed to the public internet, as it can cause naming conflicts with saved files. The upload The upload format and response format are the same as the `POST /image` endpoint.
format and response format are the same as the `POST /image` endpoint. - `POST /internal/purge?alias={alias} Purge a file by it's alias. This removes all aliases and
- `POST /internal/purge?...` Purge a file by it's filename or alias. This removes all aliases and
files associated with the query. files associated with the query.
- `?file=asdf.png` purge by filename
- `?alias=asdf.png` purge by alias
This endpoint returns the following JSON This endpoint returns the following JSON
```json ```json
@ -347,19 +344,10 @@ A secure API key can be generated by any password generator.
"aliases": ["asdf.png"] "aliases": ["asdf.png"]
} }
``` ```
- `GET /internal/aliases?...` Get the aliases for a file by it's filename or alias - `GET /internal/aliases?alias={alias} Get the aliases for a file by it's alias
- `?file={filename}` get aliases by filename
- `?alias={alias}` get aliases by alias - `?alias={alias}` get aliases by alias
This endpiont returns the same JSON as the purge endpoint This endpiont returns the same JSON as the purge endpoint
- `GET /internal/filename?alias={alias}` Get the filename for a file by it's alias
This endpoint returns the following JSON
```json
{
"msg": "ok",
"filename": "asdf.png"
}
```
Additionally, all endpoints support setting deadlines, after which the request will cease Additionally, all endpoints support setting deadlines, after which the request will cease
processing. To enable deadlines for your requests, you can set the `X-Request-Deadline` header to an processing. To enable deadlines for your requests, you can set the `X-Request-Deadline` header to an

View file

@ -1,12 +1,12 @@
## Server configuration ## Server configuration
[server] [server]
## Optional: pict-rs binding address ## Optional: pict-rs binding address
# environment variable: PICTRS_ADDRESS # environment variable: PICTRS_SERVER__ADDRESS
# default: 0.0.0.0:8080 # default: 0.0.0.0:8080
address = '0.0.0.0:8080' address = '0.0.0.0:8080'
## Optional: pict-rs worker id ## Optional: pict-rs worker id
# environment variable PICTRS_WORKER_ID # environment variable PICTRS_SERVER__WORKER_ID
# default: pict-rs-1 # default: pict-rs-1
# #
# This is used for the internal job queue. It will have more meaning once a shared metadata # This is used for the internal job queue. It will have more meaning once a shared metadata
@ -14,7 +14,7 @@ address = '0.0.0.0:8080'
worker_id = 'pict-rs-1' worker_id = 'pict-rs-1'
## Optional: shared secret for internal endpoints ## Optional: shared secret for internal endpoints
# environment variable: PICTRS_API_KEY # environment variable: PICTRS_SERVER__API_KEY
# default: empty # default: empty
# #
# Not specifying api_key disables internal endpoints # Not specifying api_key disables internal endpoints