curveball / a12n-server

An open source lightweight OAuth2 server
Apache License 2.0
448 stars 49 forks source link

A new systems for settings. #332

Closed evert closed 3 years ago

evert commented 3 years ago

I've been wanting to revamp settings for a bit. There's currently a few different ways to provide settings, including environment variables and via the database.

There is no central place where it's clear which setting exists, and there's no good enough rules around where settings are set from (environment or db).

Furthermore, if a setting is not set, we usually have a default. What that default is, is determined by the 'caller', and also not centrally which adds the risk that if different parts of the codebase use a setting, there's nothing that enforces that that default is the same everywhere.

Lastly, I want settings to bubble up in the interface so an admin can easily see what settings are active (and where those settings came from).

My intention with this PR is to solve all these problems, and so far it's backwards compatible. This opens the door to some cool features, and hopefully makes everything a little clearer.