Writing the microservice configuration file

The config.py file is where the settings for each development environment exist. The file is divided into classes that have the definition of each environment.

The first class is BaseConfig. This class is used only as an inheritance for the other classes:

class BaseConfig: 
    """Base configuration""" 
    DEBUG = False 
    TESTING = False 
    MONGODB_SETTINGS = {} 

After the declaration of BaseConfig, we will declare the other classes that manipulate the configuration of each environment. In this case, the environments are Development, Test, and Production, representing each of the environments that we have—DevelopmentConfig, TestingConfig, and ProductionConfig classes respectively.

The classes have identical structures, ...

Get Microservice Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.