Multi-file configuration
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.
+1 to this. Love the idea. That would actually make the application more flexible on the client side.
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?
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
It would be nice to have separate configurations for different pages to make it easier to modify each of them: home.yml work.yml ...
That would be unnecessary because the pages and name attribute in the glance.yml can be used to do the same
Sure, but if you have many pages and many widgets the file may be too long and difficult to edit.