Writing the configuration file

Just as we did in our microservices with Flask before, this microservice also has a settings file, config.py. The point of attention is because we do not have configurations for access to the database. Let's take a look at the following example:

class BaseConfig: 
    """Base configuration""" 
    DEBUG = False 
    TESTING = False 
 
 
class DevelopmentConfig(BaseConfig): 
    """Development configuration""" 
    DEBUG = True 
 
 
class TestingConfig(BaseConfig): 
    """Testing configuration""" 
    DEBUG = True 
    TESTING = True 
 
 
class ProductionConfig(BaseConfig): 
    """Production configuration""" 
    DEBUG = False 

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.