Its correct to create a unique appsettings class to manage many appsettings of many microservices?

first100 81 Reputation points
2022-10-28T09:38:39.573+00:00

Just as title my doubt is related to dont break pattern of microservice.

I have some microservices with their own appsettings.json and a class for each one where i am going to load these.

The class essentially contains settings for the database and other configurations.

It makes sense to unify the appsettings class for all microservices, so that it is used in each microservice where I load the specific values of appsettings.json, in this case I could have properties that remain empty as not all microservices have in the appsettings.json the same settings.

I don't know if this can be contrary to the microservices pattern.

What do you think?
thanks

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,400 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 61,731 Reputation points
    2022-10-28T15:25:21.303+00:00

    One of the key goals of micro services is independent deployment. That is you are free to change and redeploy a micro service with out requiring any other deployments. So you need to be careful with shared code.

    Rather than one master setting class, how about individual config class for each component that maps to a section.

    note: also not clear why micro services would have a lot of common settings. they are supposed to be independent.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. first100 81 Reputation points
    2022-10-30T22:42:52.003+00:00

    Many thanks ,it my thought but im not was sure

    0 comments No comments