glance icon indicating copy to clipboard operation
glance copied to clipboard

feat: enhance asset path handling to include config directory and improve assets directory validation

Open vishalkadam47 opened this issue 7 months ago • 1 comments

Support Flexible Asset Path Resolution for Local and Docker Environments

Allow users to organize their Glance files in two ways:

  1. Simple: All files in one /config directory
  2. Advanced: Split between /config (settings) and /assets (static files) - Existing setup

Changes:

  • Improve path detection and validation
  • Keep compatibility with existing setups
  • Add helpful error messages

Single Volume Setup

Docker Compose

services:
  glance:
    image: glanceapp/glance
    volumes:
      - ./config:/app/config # All files in config directory
    ports:
      - 8080:8080

glance.yml

server:
assets-path: config
theme:
custom-css-file: /config/user.css
branding:
favicon-url: /config/favicon.png
logo-url: /config/logo.png

vishalkadam47 avatar Apr 20 '25 15:04 vishalkadam47

I don't think this change is necessary because you can already do this by having the assets directory within your config directory, mounting just the config directory and then specifying the location of the assets within glance.yml like such:

server:
  assets-path: /app/config/assets

svilenmarkov avatar Apr 22 '25 17:04 svilenmarkov

I don't think this change is necessary because you can already do this by having the assets directory within your config directory, mounting just the config directory and then specifying the location of the assets within glance.yml like such:

server:
  assets-path: /app/config/assets

if I keep custom css, js and image files in /app/config/assets this doesn't work

server:
  assets-path: /app/config/assets

theme:
  custom-css-file: /config/assets/user.css

branding:
  logo-url: /config/assets/logo.png
  favicon-url: /config/assets/favicon.png

I understand that my modifications might be wrong, but if there is any other option to use single path or with multiple sub dir for all the files please add a support

vishalkadam47 avatar May 19 '25 06:05 vishalkadam47

You must specify the path relative to the server URL, not relative to local path:

server:
  # this is a local directory path
  assets-path: /app/config/assets 

theme:
  # this is a server URL path and will resolve to www.example.com/assets/user.css
  custom-css-file: /assets/user.css 

branding:
  logo-url: /assets/logo.png
  favicon-url: /assets/favicon.png

svilenmarkov avatar May 19 '25 08:05 svilenmarkov

You must specify the path relative to the server URL, not relative to local path:

server:
  # this is a local directory path
  assets-path: /app/config/assets 

theme:
  # this is a server URL path and will resolve to www.example.com/assets/user.css
  custom-css-file: /assets/user.css 

branding:
  logo-url: /assets/logo.png
  favicon-url: /assets/favicon.png

aah you are right, may bad it was confusing a little now i get this

vishalkadam47 avatar May 19 '25 10:05 vishalkadam47

not relevant PR as it already works

vishalkadam47 avatar May 19 '25 10:05 vishalkadam47