From d4c5158e570c598f609e827027fe9b95e6efc251 Mon Sep 17 00:00:00 2001 From: "Aode (Lion)" Date: Sun, 3 Apr 2022 19:26:42 -0500 Subject: [PATCH] More readme & config doc fixes --- README.md | 22 +++++----------------- pict-rs.toml | 6 +++--- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index fda5c1e..0ab21fc 100644 --- a/README.md +++ b/README.md @@ -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 -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. 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 - exposed to the public internet, as it can cause naming conflicts with saved files. The upload - format and response format are the same as the `POST /image` endpoint. -- `POST /internal/purge?...` Purge a file by it's filename or alias. This removes all aliases and +- `POST /internal/import` for uploading an image while preserving the filename as the first alias. + The upload 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 files associated with the query. - - `?file=asdf.png` purge by filename - - `?alias=asdf.png` purge by alias This endpoint returns the following JSON ```json @@ -347,19 +344,10 @@ A secure API key can be generated by any password generator. "aliases": ["asdf.png"] } ``` -- `GET /internal/aliases?...` Get the aliases for a file by it's filename or alias - - `?file={filename}` get aliases by filename +- `GET /internal/aliases?alias={alias} Get the aliases for a file by it's alias - `?alias={alias}` get aliases by alias 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 processing. To enable deadlines for your requests, you can set the `X-Request-Deadline` header to an diff --git a/pict-rs.toml b/pict-rs.toml index ddca601..5d3a6dc 100644 --- a/pict-rs.toml +++ b/pict-rs.toml @@ -1,12 +1,12 @@ ## Server configuration [server] ## Optional: pict-rs binding address -# environment variable: PICTRS_ADDRESS +# environment variable: PICTRS_SERVER__ADDRESS # default: 0.0.0.0:8080 address = '0.0.0.0:8080' ## Optional: pict-rs worker id -# environment variable PICTRS_WORKER_ID +# environment variable PICTRS_SERVER__WORKER_ID # default: pict-rs-1 # # 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' ## Optional: shared secret for internal endpoints -# environment variable: PICTRS_API_KEY +# environment variable: PICTRS_SERVER__API_KEY # default: empty # # Not specifying api_key disables internal endpoints