Understanding Source Code for Config Settings

Hi All,

I figured out how to get new settings saved into PeerTube via the administration configuration page by following how other settings were configured in the source code. While I got it to work properly and my new settings are now saving in the database as they should, I still don’t fully understand how the config and customConfig source code sections work.

What sections and lines of code are responsible for loading the settings from the database and overriding what might be set in the actual configuration .yaml file? Do new settings have to be implemented in the .yaml configuration file, or can they be configured purely for the database only? I’m just trying to better understand this system.

The way I got my new settings working is that I modified several files:

server/controllers/api/config.ts
shared/models/server/custom-config.model.ts
shared/models/server/server-config.model.ts
client/src/app/coore/server/server.service
server/initializers/constants.ts

Maybe there could be some documentation in the future walking developers through adding new settings (some that are stored in the database only vs others that can be stored in the yaml or database)?

If someone could point me to where the database settings override what is in the yaml configuration in the source code, that would be great. I wasn’t able to find exactly how this works while exploring the source code. I didn’t need to fully understand it because I was able to extend PeerTube’s source to support my new settings, but I’d like to better understand how this piece works.

Any clarification is appreciated.

1 « J'aime »