photoprism/internal/config
2026-07-12 06:31:52 +00:00
..
customize Settings: Reorganize UI and add an Accessibility section #848 #799 #5429 2026-07-08 14:11:36 +02:00
feat Links: Use canonical trailing-slash form for website URLs 2026-06-24 17:20:30 +02:00
pwa PWA: Only emit maskable icons when the variant exists #5696 2026-07-06 10:58:16 +00:00
testdata Auth: Refactor cluster configuration and provisioning API endpoints #98 2025-09-24 08:28:38 +02:00
ttl Links: Use canonical trailing-slash form for website URLs 2026-06-24 17:20:30 +02:00
AGENTS.md Docs: Split AGENTS guides into a hierarchical structure 2026-04-09 19:28:14 +02:00
cli_context.go Go: Apply go fix modernizations across backend packages 2026-02-20 03:54:33 +01:00
cli_context_test.go Config: Refactor flag default reporting and harden Markdown rendering 2026-05-09 15:09:54 +00:00
cli_flag.go Config: Refactor flag default reporting and harden Markdown rendering 2026-05-09 15:09:54 +00:00
cli_flag_test.go FFmpeg: Use atomic.Pointer for thread-safe Exclude list access #5617 2026-05-26 15:57:59 +00:00
cli_flags.go Go: Apply go fix modernizations across backend packages 2026-02-20 03:54:33 +01:00
cli_flags_report.go Commands: Fix config options report in config/cli_flags_report.go 2025-01-17 00:20:05 +01:00
cli_flags_test.go Config: Default storage-free to -1, disabling the disk probe #5613 2026-06-01 14:52:54 +00:00
client_assets.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00
client_assets_test.go PWA: Add fs constants for "assets.json" and "manifest.json" #5274 2025-10-18 09:23:53 +02:00
client_config.go People: Load name suggestions from typeahead cache #5666 2026-06-15 14:38:04 +00:00
client_config_test.go Tests: Improve isolation and add fixes #5263 2026-07-12 05:47:21 +02:00
client_ext.go Pkg: Move /service/http/... to /http/... and add package /http/dns 2025-10-19 21:08:48 +02:00
config.go Links: Use canonical trailing-slash form for website URLs 2026-06-24 17:20:30 +02:00
config_app.go PWA: Only emit maskable icons when the variant exists #5696 2026-07-06 10:58:16 +00:00
config_app_test.go PWA: Add maskable icons, lang/dir, and install screenshots #5696 2026-06-30 19:53:52 +02:00
config_auth.go Config: Refactor frontend URI handling for configurable base paths 2026-02-25 00:55:16 +01:00
config_auth_test.go Tests: Update stale portal paths after frontend URI change 2026-06-12 19:56:38 +00:00
config_backup.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00
config_backup_test.go Auth: Refactor cluster configuration and provisioning API endpoints #98 2025-09-24 08:28:38 +02:00
config_cache.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00
config_cdn.go Config: Normalize Site/CDN base URLs to strip default ports #5590 2026-05-20 16:59:53 +02:00
config_cdn_test.go Config: Normalize Site/CDN base URLs to strip default ports #5590 2026-05-20 16:59:53 +02:00
config_cluster.go Cluster: Accept all instance roles in group config, tolerate spaces 2026-06-13 12:54:54 +00:00
config_cluster_test.go Cluster: Accept all instance roles in group config, tolerate spaces 2026-06-13 12:54:54 +00:00
config_const.go Config: Refactor flag default reporting and harden Markdown rendering 2026-05-09 15:09:54 +00:00
config_customize.go Config: Add "theme-url" option (pro/portal) and URI credential redaction 2026-02-20 02:15:52 +01:00
config_customize_test.go Config: Add "theme-url" option (pro/portal) and URI credential redaction 2026-02-20 02:15:52 +01:00
config_db.go Config: Report database errors via the system log, not the DB #5637 2026-06-03 08:42:57 +00:00
config_db_test.go Config: Fix PostgreSQL DSN recursion (#47, #4831) 2026-05-25 09:56:21 +00:00
config_faces.go Clean-up: Drop imaging and pigo library integrations #5353 #5508 #668 2026-04-01 13:47:42 +02:00
config_faces_test.go Clean-up: Drop imaging and pigo library integrations #5353 #5508 #668 2026-04-01 13:47:42 +02:00
config_features.go Auth: Gate app passwords behind a settings feature flag #5647 2026-06-09 17:36:24 +00:00
config_features_test.go Auth: Gate app passwords behind a settings feature flag #5647 2026-06-09 17:36:24 +00:00
config_ffmpeg.go Config: Raise thumbnail and conversion size limits to 16K #5669 2026-06-17 04:12:40 +00:00
config_ffmpeg_test.go Config: Raise thumbnail and conversion size limits to 16K #5669 2026-06-17 04:12:40 +00:00
config_index.go Config: Centralize SQL driver identifiers in pkg/dsn #5588 2026-05-17 14:47:43 +00:00
config_index_test.go FFmpeg: Use atomic.Pointer for thread-safe Exclude list access #5617 2026-05-26 15:57:59 +00:00
config_media.go JPEG XL: Decode natively via libvips with "djxl" fallback #5693 2026-06-25 14:31:10 +00:00
config_media_raw.go Import: Add ytdl package for downloading videos from URLs #4982 2025-05-02 10:04:34 +02:00
config_media_raw_test.go Config: Change test path in config_media_raw_test.go 2025-01-08 14:16:11 +01:00
config_media_test.go JPEG XL: Decode natively via libvips with "djxl" fallback #5693 2026-06-25 14:31:10 +00:00
config_metadata.go Import: Add ytdl package for downloading videos from URLs #4982 2025-05-02 10:04:34 +02:00
config_metadata_test.go Backups: Refactor config and add "sidecar-yaml" config option #4243 2024-05-13 09:21:34 +02:00
config_oidc.go OIDC: Add configurable authorization prompt option #5698 2026-06-27 12:35:04 +00:00
config_oidc_test.go OIDC: Add configurable authorization prompt option #5698 2026-06-27 12:35:04 +00:00
config_places.go Places: Add config option to specify location details locale #465 #883 2025-07-03 12:58:20 +02:00
config_places_test.go Places: Add config option to specify location details locale #465 #883 2025-07-03 12:58:20 +02:00
config_proxy.go Config: Add option to set a proxy for outgoing connections #3132 2023-01-19 20:46:27 +01:00
config_proxy_test.go Config: Add option to set a proxy for outgoing connections #3132 2023-01-19 20:46:27 +01:00
config_server.go Server: Add zstd compression support #5550 2026-05-03 10:10:33 +00:00
config_server_test.go Server: Add zstd compression support #5550 2026-05-03 10:10:33 +00:00
config_services.go Services: Add CIDR allowlist for discovery and WebDAV traffic #5461 2026-02-26 18:18:40 +01:00
config_site.go Config: Prefer SiteName for app name and site title 2026-06-10 14:28:33 +00:00
config_site_test.go Tests: Update stale portal paths after frontend URI change 2026-06-12 19:56:38 +00:00
config_storage.go Config: Default storage-free to -1, disabling the disk probe #5613 2026-06-01 14:52:54 +00:00
config_storage_test.go Config: Make TempPath test independent of TMPDIR and run order 2026-06-01 11:21:46 +00:00
config_test.go Tests: Improve isolation and add fixes #5263 2026-07-12 05:47:21 +02:00
config_thumb.go Config: Raise thumbnail and conversion size limits to 16K #5669 2026-06-17 04:12:40 +00:00
config_thumb_test.go Config: Raise thumbnail and conversion size limits to 16K #5669 2026-06-17 04:12:40 +00:00
config_tls.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00
config_tls_test.go Develop: Change default Site URL to use HTTPS as required for OIDC #782 2024-06-28 00:21:19 +02:00
config_upload.go Config: Add upload-limit flag to limit total upload size #4929 #4895 2025-04-05 15:44:13 +02:00
config_upload_test.go Upload: Allow to limit the types of files users can upload #4895 2025-03-25 06:32:01 +01:00
config_usage.go Config: Improve low storage detection #5613 2026-05-29 01:45:04 +02:00
config_usage_test.go Config: Improve low storage detection #5613 2026-05-29 01:45:04 +02:00
config_vision.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00
config_vision_test.go Security: Add gosec fixes with shared URL and fs validation helpers 2026-03-03 16:38:41 +01:00
develop.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00
develop_test.go Config: Add "develop" feature flag to disable new viewer sidebar #3168 2025-02-03 12:29:02 +01:00
env.go Security: Improve credential handling across the cluster tooling #98 2025-10-20 00:06:17 +02:00
env_test.go Config: Read admin and database password from file #2302 2025-03-28 21:00:56 +01:00
err.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00
error.go Config: Refactor directory initialization and improve inline docs 2023-06-14 16:44:45 +02:00
expand.go Auth: Refactor cluster configuration and provisioning API endpoints #98 2025-09-24 08:28:38 +02:00
expand_test.go Auth: Refactor cluster configuration and provisioning API endpoints #98 2025-09-24 08:28:38 +02:00
extensions.go Pkg: Move /service/http/... to /http/... and add package /http/dns 2025-10-19 21:08:48 +02:00
extensions_test.go CLI: Init config in "photoprism stop" via InitCore() to avoid bootstrap 2026-02-07 13:57:15 +01:00
flags.go OIDC: Add configurable authorization prompt option #5698 2026-06-27 12:35:04 +00:00
flags_grouprole_test.go ACL: Generate CLI role & auth-provider help from role tables #5667 2026-06-16 11:57:44 +02:00
logs.go Config: Set SystemLog level based on application log level #5167 2025-10-07 21:30:19 +02:00
messages.go Links: Use canonical trailing-slash form for website URLs 2026-06-24 17:20:30 +02:00
options.go OIDC: Add configurable authorization prompt option #5698 2026-06-27 12:35:04 +00:00
options_report.go Config: Exclude inline non-flag fields from config-yaml report 2026-03-05 04:37:29 +01:00
options_report_test.go Config: Exclude inline non-flag fields from config-yaml report 2026-03-05 04:37:29 +01:00
options_test.go Docs: Bump remaining 2025 copyright stamps to 2026 2026-05-25 14:46:32 +00:00
README.md Auth: Add "Stay signed in on this device" login toggle #5476 2026-03-08 11:25:40 +01:00
report.go Auth: Land cluster sign-out on the Portal login without return_to 2026-06-12 19:56:44 +00:00
report_sections.go Config: Anchor report Storage section at storage-path, not config-path 2026-06-01 15:56:08 +00:00
report_test.go Faces: Add "faces config" subcommand to list face options #5597 2026-05-21 11:17:37 +02:00
robots.txt Config: Serve "robots.txt" file to control how site is indexed #4574 2024-11-07 19:09:43 +01:00
schedule.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00
schedule_test.go Config: Add “daily” and “weekly” backup schedule options #4243 2024-05-19 14:17:01 +02:00
settings.go Config: Move Portal flag to ClientConfig struct 2025-10-15 23:32:54 +02:00
test.go Tests: Refine isolated test-folder cleanup and logging #5263 2026-07-12 06:31:52 +00:00
test_test.go Tests: Refine isolated test-folder cleanup and logging #5263 2026-07-12 06:31:52 +00:00
thumbnails.go Video: Refactor FFmpeg Transcoding Size Limit #3466 #3498 #3549 2023-07-18 15:15:04 +02:00
var.go CI: Apply Go linter recommendations to "internal/config" packages #5330 2025-11-22 20:00:53 +01:00

PhotoPrism — Config Package

Last Updated: March 8, 2026

Overview

PhotoPrisms runtime configuration is managed by this package. Fields are defined in options.go and then initialized with values from command-line flags, environment variables, and optional YAML files (storage/config/*.yml).

Client config values are derived from the runtime configuration and exposed to the frontend via GET /api/v1/config. This includes a storageNamespace value (SHA-256 hash of SiteUrl) used by the browser to scope namespaced browser-storage keys on shared domains.

Storage Namespace & Legacy Session Compatibility

  • storageNamespace is deterministic per SiteUrl (SHA-256(SiteUrl)) and is used by the frontend storage wrappers to isolate data on shared domains.
  • The preferred frontend/browser contract uses namespaced keys in the format pp:<storageNamespace>:<key>, with pp:root: as the fallback prefix when no namespace is available.
  • Frontend reads namespaced keys first and then falls back to selected legacy global keys; when a legacy value is found, it is migrated to the active namespace on read.
  • New mobile or web-view integrations should write the namespaced session preference flag plus both namespaced session.token and session.id keys when pre-populating authentication data.
  • Writing only a token is not enough to restore an authenticated user session in current frontend logic, because session restore requires both token and session id.
  • A namespaced localStorage["pp:<storageNamespace>:session"] value of "true" selects namespaced sessionStorage for the active session. Any other value uses namespaced localStorage.
  • The OIDC callback bridge still honors the legacy unnamespaced localStorage["session"] === "true" preference during migration, but new integrations should not depend on that fallback.
  • Older compatibility keys (authToken / sessionId) are only auto-migrated when both are present.

Sources & Precedence

PhotoPrism loads configuration in the following order:

  1. Built-in defaults defined in this package.
  2. defaults.yml — optional configuration defaults. PhotoPrism first checks /etc/photoprism/defaults.yml (or .yaml). If that file is missing or empty, it automatically falls back to storage/config/defaults.yml (respecting .yml / .yaml as well) under PHOTOPRISM_CONFIG_PATH. See defaults.yml if you package PhotoPrism for other environments and need to override the compiled defaults.
  3. Environment variables prefixed with PHOTOPRISM_… and specified in flags.go along with the CLI flags. This is the primary override mechanism in container environments.
  4. options.yml — user-level configuration stored under storage/config/options.yml (or another directory controlled by PHOTOPRISM_CONFIG_PATH). Values here override both defaults and environment variables, see options.yml.
  5. CLI flags (for example photoprism --cache-path=/tmp/cache). Flags always win when a conflict exists.

The PHOTOPRISM_CONFIG_PATH variable controls where PhotoPrism looks for YAML files (defaults to storage/config).

Any change to configuration (flags, env vars, YAML files) requires a restart. The Go process reads options during startup and does not watch for changes.

HTTP Hardening Defaults

  • PHOTOPRISM_HTTP_HEADER_TIMEOUT / --http-header-timeout configures http.Server.ReadHeaderTimeout and defaults to 15s.
  • PHOTOPRISM_HTTP_HEADER_BYTES / --http-header-bytes configures http.Server.MaxHeaderBytes and defaults to 1048576 (1 MiB).
  • PHOTOPRISM_HTTP_IDLE_TIMEOUT / --http-idle-timeout configures http.Server.IdleTimeout and defaults to 180s.
  • ReadTimeout and WriteTimeout remain disabled globally so large uploads/downloads are not interrupted by a one-size-fits-all timeout.

Inspect Before Editing

Before changing environment variables or YAML files, run photoprism config | grep -i <flag> to confirm the current value of a flag, such as site-url, or site to show all related values:

photoprism config | grep -i site

Example output:

Name Value
site-url https://app.localssl.dev/
site-https true
site-domain app.localssl.dev
site-author @photoprism_app
site-title PhotoPrism

CLI Reference

  • photoprism help (or photoprism --help) lists all subcommands and global flags.
  • photoprism show config (alias photoprism config) renders every active option along with its current value. Pass --json, --md, --tsv, or --csv to change the output format. Portal-only rows (portal-proxy, portal-proxy-uri, portal-config-path, portal-theme-path) are included only when node-role is set to portal.
  • photoprism show config-options prints the description and default value for each option. Use this when updating flags.go.
  • photoprism show config-yaml displays the configuration keys and their expected types in the same structure that the YAML files use. It is a read-only helper meant to guide you when editing files under storage/config.
  • Additional show subcommands document search filters, metadata tags, and supported thumbnail sizes; see internal/commands/show.go for the complete list.
  • Pro/Portal builds additionally expose PHOTOPRISM_THEME_URL / --theme-url (hidden in CE/Plus), which can bootstrap config/theme/ from a secure ZIP download when no theme files are present yet. HTTP Basic credentials in the URL are supported for protected artifact endpoints and are redacted in config reports.