What is the best way to store site configuration data?

I had a question about saving site configuration data.

We have a platform for web applications. The idea is that different customers can post and display their data on their own website, which is located on top of this platform. Each site has a configuration that determines which panels related to the client are displayed on which pages.

The system was originally designed to store all configuration data for each site in the database. When the site loads, all configuration data is loaded into the SiteConfiguration object, and client panels are created based on the contents of this object. This works, but it’s very difficult for me to apply change requests or add new sites, because there is so much data to sift and it’s hard to maintain the mental model of the site and its configuration.

Recently, I was tasked with developing a subset of some sites that will be created as PDF documents for printing. I decided to use a different approach to how I would define the configuration, instead of storing the configuration data in the database, I wrote XML files to store the data. It’s much more convenient for me to work because, instead of reading meaningless data lines associated with other meaningless data lines, I have meaningful documents with semantic, readable information with relationships defined by a visually understandable nesting of elements.

So, now with these two approaches to storing site configuration data, I would like to get the opinions of people more experienced in solving this problem regarding these two approaches. What is the best way to store site configuration data? Is there a better way than the two methods that I have outlined here?

Note: StackOverflow tells me that this question seems subjective and is likely to be closed. I am not trying to be subjective. I would like to know how best to approach this issue next time, and if people with experience in the industry can make a certain contribution.

+4
source share
3 answers

if the information is needed for each specific client configuration, it is probably best done in a database with an administrative tool written for it so that non-technical people can also manage it. It is also easier when you need to manage versions / stories. XML is not always the best in this part. In addition, XML is ultimately difficult to maintain (for non-technical people).

Do you read XML every time from disk (performance hit) or store it in the cache in memory? Or the solution you choose, caching makes a big difference in performance.

Grz, Kris.

0
source

You are using ASP.NET, so what is wrong with web.config for your basic settings (if it is deployed on a project), then, as you said, custom XML or database configuration options for something more complex (or if you have several users / clients with the same project deployment)?

I would use only custom XML documents for something like a “site layout document” where things won't change often and you have a lot of semi-independent data (like 23553123). And the layout should be handled by css anyway.

0
source

XML is a good choice for our team (app.config or web.config or a custom configuration file, it depends), but sometimes it’s better to develop a configuration API to create configurations in the code. For example, modern IoC containers have code configuration APIs with smooth interfaces . This approach can be useful if you need to configure many similar entities or want to achieve good readability. But this does not work if non-programmers need to create configurations.

0
source

Source: https://habr.com/ru/post/1313162/


All Articles