glanceapp / glance

A self-hosted dashboard that puts all your feeds in one place
GNU Affero General Public License v3.0
7.28k stars 250 forks source link

Multi-file configuration #79

Open p5 opened 3 months ago

p5 commented 3 months ago

Hey!

First off, I wanted to say this is a great project, and while I only found it recently, I have already recommended it to many others who are looking for an all-in-one homepage for all their news, links and media.

I would like to propose a configuration option which allows users to compose their configuration from multiple YAML files. This allows someone to ship a default configuration, but also allow users to extend the configuration without touching the basic config.

An example of how this could be used is a system-wide configuration file in /etc/glance/glance.yaml, and user-specific configurations in $HOME/.config/glance.yaml which extends the system config. This could be additional pages, themes etc.

AMS003010 commented 3 months ago

+1 to this. Love the idea. That would actually make the application more flexible on the client side.

svilenmarkov commented 3 months ago

Hey, thanks for the idea and for supporting the project!

This would be difficult as the YAML spec doesn't have a standardized way of importing files which leaves me with figuring out a way of specifying which things should be inherited and which should get overwritten.

For example, if you had this inside your base glance.yml:

pages:
  - name: Home
    columns:
      - size: full
        widgets:
          - type: reddit

And this inside your user configuration which extends the base:

pages:
  - name: Home
    columns:
      - size: full
        widgets:
          - type: reddit
            sort-by: new

What should happen? Should you end up with two Reddit widgets? Should the existing one inherit the new properties? What if you want to be able to do both in different scenarios, how would you achieve that?

AMS003010 commented 3 months ago

Suppose we are trying to extend/overwrite the properties of a widget, we could have an extra field called overwrite under each type field.


In the below case of user-specific configurations file glance.yaml , the rss widget properties' will be overwritten by the user glance.yaml file

widgets:
          - type: calendar

          - type: rss
            overwrite: true
            limit: 10
            collapse-after: 3
            cache: 3h
            feeds:
              - url: https://ciechanow.ski/atom.xml
              - url: https://www.joshwcomeau.com/rss.xml
                title: Josh Comeau
              - url: https://samwho.dev/rss.xml
              - url: https://awesomekling.github.io/feed.xml
              - url: https://ishadeed.com/feed.xml
                title: Ahmad Shadeed




In the below case of user-specific configurations file glance.yaml , the rss widget will inherit the system-wide configuration file glance.yaml, but can extend any new properties in the user glance.yaml file

widgets:
          - type: calendar

          - type: rss
            overwrite: false
            limit: 10
            collapse-after: 3
            cache: 3h
            feeds:
              - url: https://ciechanow.ski/atom.xml
              - url: https://www.joshwcomeau.com/rss.xml
                title: Josh Comeau
              - url: https://samwho.dev/rss.xml
              - url: https://awesomekling.github.io/feed.xml
              - url: https://ishadeed.com/feed.xml
                title: Ahmad Shadeed