From ea96ea86c139619db004ee9adc4f0be01a58bc3d Mon Sep 17 00:00:00 2001 From: Jianyun Date: Mon, 5 Aug 2024 16:58:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- README.md | 45 +++------------------- docker-compose-yaml => docker-compose.yaml | 18 ++++----- main.go | 2 +- 4 files changed, 16 insertions(+), 51 deletions(-) rename docker-compose-yaml => docker-compose.yaml (60%) diff --git a/Dockerfile b/Dockerfile index 1edb24f..8130e54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ ENV CALIBRE_STATIC_DIR=/app/static WORKDIR /app COPY --from=build /calibre-api ./calibre-api -COPY config.yaml ./config-example.yaml +COPY config.yaml ./config.yaml COPY --from=app /app/dist/ /app/static diff --git a/README.md b/README.md index 57aaac1..9bdb8d5 100644 --- a/README.md +++ b/README.md @@ -91,36 +91,14 @@ curl -X "POST" "http://localhost:8080/index/update" -H 'Content-Type: applicatio ```yaml address: :8080 debug: false +staticDir: "/app/static" +tmpDir: ".files" +content: + server: https://lib.pve.icu search: host: http://127.0.0.1:7700 apikey: index: books - trimPath: /data/book/calibre/library -storage: - ## 选择文件存储的位置 webdav\local\minio - use: webdav - tmpdir: ".files" - ## webdav配置 - webdav: - host: http://xxxxxx:2344 - user: xxxxx - password: "xxxxxxxxxxxxx" - path: /book/calibre/library - ## 本地路径 - local: - path: /book/calibre/library - ## minio s3或者s3兼容存储 - minio: - endpoint: xxx - accessKeyID: xxx - secretAccessKey: xxxx - useSSL: true - bucketName: bucket - path: /book/calibre/library - - - - ``` ### 环境变量 @@ -130,24 +108,13 @@ storage: ```text CALIBRE_ADDRESS CALIBRE_DEBUG -CALIBRE_STATIC_DIR -CALIBRE_TEMPLATE_DIR +CALIBRE_STATICDIR +CALIBRE_TMP_DIR ## search CALIBRE_SEARCH_HOST CALIBRE_SEARCH_APIKEY CALIBRE_SEARCH_INDEX -CALIBRE_SEARCH_TRIMPATH - -## storage -CALIBRE_STORAGE_USE -CALIBRE_STORAGE_TMPDIR - -## webdav -CALIBRE_STORAGE_WEBDAV_HOST -CALIBRE_STORAGE_WEBDAV_USER -CALIBRE_STORAGE_WEBDAV_PASSWORD -CALIBRE_STORAGE_WEBDAV_PATH ``` ## 适配阅读书源 diff --git a/docker-compose-yaml b/docker-compose.yaml similarity index 60% rename from docker-compose-yaml rename to docker-compose.yaml index be0898c..4563650 100644 --- a/docker-compose-yaml +++ b/docker-compose.yaml @@ -1,25 +1,22 @@ services: # main service calibre-api: +# build: +# context: . +# dockerfile: Dockerfile restart: unless-stopped container_name: calibre-api image: ghcr.io/jianyun8023/calibre-api:latest - volumes: - - /book/calibre/library:/book/calibre/library ports: - "8080:8080" environment: - TZ=Asia/Shanghai - CALIBRE_DEBUG=true - - CALIBRE_STATIC_DIR=/app/static - - CALIBRE_TEMPLATE_DIR=/app/templates + - CALIBRE_CONTENT_SERVER=https://lib.pve.icu - CALIBRE_SEARCH_HOST=http://meilisearch:7700 #- CALIBRE_SEARCH_APIKEY= - CALIBRE_SEARCH_INDEX=books - - CALIBRE_SEARCH_TRIMPATH=/data/calibre/library - - CALIBRE_STORAGE_USE=local - - CALIBRE_STORAGE_TMPDIR=/tmp - - CALIBRE_STORAGE_LOCAL_PATH=/book/calibre/library + - CALIBRE_TMPDIR=/tmp depends_on: - meilisearch meilisearch: @@ -27,7 +24,8 @@ services: container_name: meilisearch image: getmeili/meilisearch:v1.9 volumes: - - ./meili_data:/meili_data + - meili_data:/meili_data ports: - "7700:7700" - +volumes: + meili_data: diff --git a/main.go b/main.go index 3efcf40..c218de8 100644 --- a/main.go +++ b/main.go @@ -80,7 +80,7 @@ func initConfig() *calibre.Config { viper.AddConfigPath(".") viper.SetDefault("address", ":8080") viper.SetDefault("staticDir", "./static") - viper.SetDefault("tmpDir", "./static") + viper.SetDefault("tmpDir", "/tmp") viper.SetEnvPrefix("CALIBRE") viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) viper.AutomaticEnv()