feat(shared): add suffix to shared config models
This commit is contained in:
parent
76069006b5
commit
b527c2704d
|
@ -19,15 +19,15 @@ Load your configuration using a subclass of `libretime_shared.config.BaseConfig`
|
|||
```py
|
||||
from pydantic import BaseModel
|
||||
|
||||
from libretime_shared.config import RabbitMQ, BaseConfig
|
||||
from libretime_shared.config import RabbitMQConfig, BaseConfig
|
||||
|
||||
class Analyzer(BaseModel):
|
||||
class AnalyzerConfig(BaseModel):
|
||||
bpm_enabled: bool = False
|
||||
bpm_track_max_length: int
|
||||
|
||||
class Config(BaseConfig):
|
||||
rabbitmq: RabbitMQ
|
||||
analyzer: Analyzer
|
||||
rabbitmq: RabbitMQConfig
|
||||
analyzer: AnalyzerConfig
|
||||
|
||||
config = Config(filepath="/etc/libretime/config.yml")
|
||||
```
|
||||
|
|
|
@ -99,7 +99,7 @@ class BaseConfig(BaseModel):
|
|||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class Database(BaseModel):
|
||||
class DatabaseConfig(BaseModel):
|
||||
host: str = "localhost"
|
||||
port: int = 5432
|
||||
name: str = "libretime"
|
||||
|
@ -108,7 +108,7 @@ class Database(BaseModel):
|
|||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class RabbitMQ(BaseModel):
|
||||
class RabbitMQConfig(BaseModel):
|
||||
host: str = "localhost"
|
||||
port: int = 5672
|
||||
name: str = "libretime"
|
||||
|
|
|
@ -4,13 +4,13 @@ from unittest import mock
|
|||
|
||||
from pytest import mark, raises
|
||||
|
||||
from libretime_shared.config import BaseConfig, Database
|
||||
from libretime_shared.config import BaseConfig, DatabaseConfig
|
||||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class FixtureConfig(BaseConfig):
|
||||
api_key: str
|
||||
database: Database
|
||||
database: DatabaseConfig
|
||||
|
||||
|
||||
FIXTURE_CONFIG_RAW = """
|
||||
|
|
Loading…
Reference in New Issue