Configuration

HomeGallery has serveral modules/parts which can be configured through the gallery.config.yml file. It is loaded on the start of the CLI and is created if not found. It comes with a well selected preset of settings.

In a bare minimum configuration you need to define your media directories:

1sources:
2  - ~/Pictures

By default the configuration files are stored to ~/.config/home-gallery and the previews are stored in ~/.cache/home-gallery/storage.

It is advisable to initialize the configuration through the run init command:

gallery run init --source ~/Pictures /mnt/media

Full configuration

The full configuration contains valuable details to some settings

  1#
  2# HomeGallery configuration file
  3#
  4#
  5# Default configuration file is gallery.config.yml. JSON format is
  6# also supported (gallery.config.json)
  7#
  8# This is a comment, starting with hash tag and space ('# ')
  9# A default value starting with hash tag and variable ('#baseDir...')
 10#
 11# Directory value examples:
 12# - /absolute/directory
 13# - relative/directory/to/current/working/dir
 14# - ~/directory/in/your/home
 15# - ./relative/directory/to/configuration/file
 16#
 17# Variable replacements
 18#   baseDir: '~'
 19#   configDir: '{baseDir}/.config/home-gallery'
 20# configDir is replaced to '~/.config/home-gallery' and than to '$HOME/.config/home-gallery'
 21#
 22# Variables are overwritten by environment variables
 23#
 24# Variables are baseDir, configDir, configPrefix, cacheDir and dir in sources
 25# or environment variables GALLERY_BASE_DIR, GALLERY_CONFIG_DIR, GALLERY_CONFIG_PREFIX, GALLERY_CACHE_DIR
 26
 27#
 28# General
 29#
 30#baseDir: '~'
 31#configDir: '{baseDir}/.config/home-gallery'
 32# file prefix for index, database and events
 33#configPrefix: ''
 34#cacheDir: '{baseDir}/.cache/home-gallery'
 35
 36#
 37# Sources
 38#
 39# List of media source directories. These can be read only.
 40#
 41# All sources are used to build the gallery database. If you need
 42# different databases or gallery instances use different gallery
 43# configurations
 44sources:
 45  - dir: '{baseDir}/Pictures'
 46    #index: '{configDir}/{configPrefix}{basename(dir)}.idx'
 47    # excludes are using gitignore patterns
 48    #excludes:
 49      #- .DS_Store
 50      #- ._*
 51      #- '*.tmp'
 52      #- '*cache*'
 53    #excludeIfPresent: .galleryignore
 54    # excludeFromFile: '{configDir}/excludes'
 55    # Use maxFilesize to exclude big files such as videos to speedup initial setup
 56    # maxFilesize: 20M
 57    # If source directory/disk is offline/unmounted set it to true.
 58    # Offline sources require an index file. Previews and meta data
 59    # should be extracted first before marking a source offline
 60    #offline: false
 61    # Filename matcher for checksum recalculation
 62    # size-ctime-inode: this matcher should be used if possible, might
 63    #                   not work on windows
 64    # size-ctime: this matcher should be used if stable fs inodes are
 65    #             not available and might not work for fuse shares
 66    # size: this matcher should be used if you know what you are doing
 67    #matcher: size-ctime-inode
 68
 69#
 70# Extractor settings
 71#
 72#extractor:
 73  # excludes:
 74  #   - *.xmp
 75  #   - *.svg
 76  # excludeFromFile: '{configDir}/excludes'
 77  # Preview image settings
 78  #image:
 79  #  previewSizes: [1920, 1280, 800, 320, 128]
 80  #  previewQuality: 80
 81  #video:
 82  #  previewSize: 720 # used as preview size and preview filename
 83  #  ext: mp4 # used as target video container and preview filename
 84  #  scale: -2:'min(720,ih)' # overwrites previewSize. E.g. -2:'min(ih,max(720,min(1080,ih*.5)))' for 720p <= height*0.5 <= 1080p or height, if height < 720
 85  #  frameRate: 30
 86  #  maxVideoBitRate: 4000 # in KB
 87  #  videoEncoder: libx264
 88  #  preset: slow
 89  #  profile: baseline
 90  #  level: '3.0'
 91  #  addFfmpegArgs: [...] # Additional ffmpeg args
 92  #  customFfmpegArgs: [...] # custom ffmpeg args for video conversion, replaces all other settings such previewSize, videoEncoder, addFfmpegArgs, ...
 93  # Api Server is used for image similarity, object and face detection
 94  #apiServer:
 95  #  url: https://api.home-gallery.org
 96  #  timeout: 30
 97  #  concurrent: 5
 98  #  disable:
 99  #    - similarDetection
100  #    - objectDetection
101  #    - faceDetection
102  #geoReverse:
103  #  url: https://nominatim.openstreetmap.org
104  #   Preffered address language of geo code reverse lookups
105  #   addressLanguage: [de, en-US] # for multiple languages
106  #  addressLanguage: [en, de]
107  # excludes are using gitignore patterns
108  #excludes: []
109  # Use native system commands. It is recoomended on armv6 and arm7 platform
110  # since the npm packages do not provide binaries for these platforms
111  #useNative:
112  #  - vipsthumbnail # use libvips to resize images
113  #  - convert # use ImageMagick to resize images
114  #  - ffprobe
115  #  - ffmpeg
116
117#
118# Storage and files configuration
119#
120#storage:
121  #dir: '{cacheDir}/storage'
122#database:
123  #file: '{configDir}/{configPrefix}database.db'
124  # The full database creation is memory consuming. The default value is 2048 MB.
125  # On memory errors or for larger photo collections (>50000 images) 4096 MB is recommended
126  # Use less memory for smaller devices (e.g. Raspberry Pi Zero), e.g. 512 MB.
127  # Node's default memory limit is 512 MB (changeable via --max-old-space-size node arg)
128  #maxMemory: 2048
129  # excludes:
130  #   - *.xmp
131  #   - *.svg
132  # excludeFromFile: '{configDir}/excludes'
133  # supportedTypes
134  #   - image
135  #   - rawImage
136  #   - video
137#events:
138  #file: '{configDir}/{configPrefix}events.db'
139
140#
141# Server configuration
142#
143#server:
144  #port: 3000
145  #host: '0.0.0.0'
146  # security configuration for https
147  # key: '{configDir}/server.key'
148  # cert: '{configDir}/server.crt'
149  # Open browser when server starts
150  #openBrowser: true
151  # Enable basic authentication users and ip whitelist rules which require no authentication
152  # First matching rule wins. Default rules are: allow: localhost and deny: all.
153  # Hashed password can be generated via
154  #   node -e "pw=process.argv[1]||'';sha1=require('crypto').createHash('sha1').update(pw).digest('base64');console.log('{SHA}'+sha1)" password
155  #   {SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
156  # auth:
157  #  users:
158  #    - username: password
159  #    - username: '{SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g='
160  #  rules:
161  #    - allow: localhost
162  #    - allow: '192.168/16'
163  #    - deny: all
164  #basePath: /
165  #watchSources: true
166
167#
168# Webapp configuration
169#
170#webapp:
171  # Disabled webapp features
172  #disabled:
173    #- edit
174    #- serverEvents
175    #- pwa
176    #- offlineDatabase
177
178logger:
179  # Currently console and file loggers are available
180  - type: console
181    # Log level could be one of trace, debug, info, warn, error, fatal, silent
182    level: info
183    # format: json
184  # File logger format is in newline delimited JSON. See http://ndjson.org
185  - type: file
186    # Log level could be one of trace, debug, info, warn, error, fatal, silent
187    level: debug
188    file: '{configDir}/{configPrefix}gallery.log'