From dc07787566dfcd80975b70d55bebfc1c5c09860e Mon Sep 17 00:00:00 2001 From: Alan Grainger <16197738+alangrainger@users.noreply.github.com> Date: Wed, 30 Jul 2025 10:47:16 +0200 Subject: [PATCH] #115 Allow inline configuration as an option --- README.md | 15 +++++++++++++++ app/package-lock.json | 4 ++-- app/package.json | 2 +- app/src/functions.ts | 9 +++++++-- docker-compose.yml | 4 ++-- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2f7531b..ec9dff2 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,21 @@ There are some additional configuration options you can change, for example the 3. Restart your container and your custom configuration should be active. +Alternatively, rather than a `config.json` file, you can pass the configuration inline from your `docker-compose.yml` file like this: + +```yaml + environment: + PUBLIC_BASE_URL: https://your-proxy-url.com + IMMICH_URL: http://your-internal-immich-server:2283 + CONFIG: | + { + "ipp": { + "singleImageGallery": false, + ... + } + } +``` + ### Immich Public Proxy options | Option | Type | Description | diff --git a/app/package-lock.json b/app/package-lock.json index 37e0807..a620df0 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "immich-public-proxy", - "version": "1.12.0", + "version": "1.12.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "immich-public-proxy", - "version": "1.12.0", + "version": "1.12.1", "license": "AGPL-3.0", "dependencies": { "archiver": "^7.0.1", diff --git a/app/package.json b/app/package.json index 6c34395..aa00415 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "immich-public-proxy", - "version": "1.12.0", + "version": "1.12.1", "scripts": { "dev": "ts-node src/index.ts", "build": "npx tsc", diff --git a/app/src/functions.ts b/app/src/functions.ts index 20c660a..f47155b 100644 --- a/app/src/functions.ts +++ b/app/src/functions.ts @@ -4,8 +4,13 @@ import { DownloadAll, SharedLink } from './types' let config = {} try { - const configJson = require(process.env.IPP_CONFIG || '../config.json') - if (typeof configJson === 'object') config = configJson + if (process.env.CONFIG) { + // Attempt to parse docker-compose config string into JSON (if specified) + config = JSON.parse(process.env.CONFIG) + } else { + const configJson = require(process.env.IPP_CONFIG || '../config.json') + if (typeof configJson === 'object') config = configJson + } } catch (e) { console.log(e) } diff --git a/docker-compose.yml b/docker-compose.yml index d4147f6..03f38c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,8 +6,8 @@ services: ports: - "3000:3000" environment: - - PUBLIC_BASE_URL=https://your-proxy-url.com - - IMMICH_URL=http://your-internal-immich-server:2283 + PUBLIC_BASE_URL: https://your-proxy-url.com + IMMICH_URL: http://your-internal-immich-server:2283 healthcheck: test: curl -s http://localhost:3000/share/healthcheck -o /dev/null || exit 1 start_period: 10s