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 baseDir, configDir, configPrefix, cacheDir and dir in sources
 23#
 24# Variables baseDir, configDir, configPrefix and cacheDir are overwritten by environment
 25# 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  # Preview image settings
 74  #image:
 75  #  previewSizes: [1920, 1280, 800, 320, 128]
 76  #  previewQuality: 80
 77  #video:
 78  #  previewSize: 720 # used as preview size and preview filename
 79  #  ext: mp4 # used as target video container and preview filename
 80  #  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
 81  #  frameRate: 30
 82  #  maxVideoBitRate: 4000 # in KB
 83  #  videoEncoder: libx264
 84  #  preset: slow
 85  #  profile: baseline
 86  #  level: '3.0'
 87  #  addFfmpegArgs: [...] # Additional ffmpeg args
 88  #  customFfmpegArgs: [...] # custom ffmpeg args for video conversion, replaces all other settings such previewSize, videoEncoder, addFfmpegArgs, ...
 89  # Api Server is used for image similarity, object and face detection
 90  #apiServer:
 91  #  url: https://api.home-gallery.org
 92  #  timeout: 30
 93  #  concurrent: 5,
 94  #  disable:
 95  #    - similarDetection
 96  #    - objectDetection
 97  #    - faceDetection
 98  #geoReverse:
 99  #  url: https://nominatim.openstreetmap.org
100  #   Preffered address language of geo code reverse lookups
101  #   addressLanguage: [de, en-US] # for multiple languages
102  #  addressLanguage: [en, de]
103  # excludes are using gitignore patterns
104  #excludes: []
105  # Use native system commands. It is recoomended on armv6 and arm7 platform
106  # since the npm packages do not provide binaries for these platforms
107  #useNative:
108  #  - vipsthumbnail # use libvips to resize images
109  #  - convert # use ImageMagick to resize images
110  #  - ffprobe
111  #  - ffmpeg
112
113#
114# Storage and files configuration
115#
116#storage:
117  #dir: '{cacheDir}/storage'
118#database:
119  #file: '{configDir}/{configPrefix}database.db'
120  # The full database creation is memory consuming. The default value is 2048 MB.
121  # On memory errors or for larger photo collections (>50000 images) 4096 MB is recommended
122  # Use less memory for smaller devices (e.g. Raspberry Pi Zero), e.g. 512 MB.
123  # Node's default memory limit is 512 MB (changeable via --max-old-space-size node arg)
124  #maxMemory: 2048
125#events:
126  #file: '{configDir}/{configPrefix}events.db'
127
128#
129# Server configuration
130#
131#server:
132  #port: 3000
133  #host: '0.0.0.0'
134  # security configuration for https
135  # key: '{configDir}/server.key'
136  # cert: '{configDir}/server.crt'
137  # Open browser when server starts
138  #openBrowser: true
139  # Enable basic authentication users and ip whitelist rules which require no authentication
140  # First matching rule wins. Default rules are: allow: localhost and deny: all.
141  # Hashed password can be generated via
142  #   node -e "pw=process.argv[1]||'';sha1=require('crypto').createHash('sha1').update(pw).digest('base64');console.log('{SHA}'+sha1)" password
143  #   {SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
144  # auth:
145  #  users:
146  #    - username: password
147  #    - username: '{SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g='
148  #  rules:
149  #    - allow: localhost
150  #    - allow: '192.168/16'
151  #    - deny: all
152  #basePath: /
153  #watchSources: true
154
155logger:
156  # Currently console and file loggers are available
157  - type: console
158    # Log level could be one of trace, debug, info, warn, error, fatal, silent
159    level: info
160    # format: json
161  # File logger format is in newline delimited JSON. See http://ndjson.org
162  - type: file
163    # Log level could be one of trace, debug, info, warn, error, fatal, silent
164    level: debug
165    file: '{configDir}/{configPrefix}gallery.log'