/
settings.py
43 lines (35 loc) · 1.38 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import (
absolute_import,
unicode_literals,
)
from conformity import fields
from conformity.settings import (
SettingsData,
SettingsSchema,
)
from pysoa.client.middleware import ClientMiddleware
from pysoa.common.settings import SOASettings
from pysoa.common.transport.base import ClientTransport as BaseClientTransport
__all__ = (
'ClientSettings',
)
class ClientSettings(SOASettings):
"""
Base settings class for all clients, whose `middleware` values are restricted to subclasses of `ClientMiddleware`
and whose `transport` values are restricted to subclasses of `BaseClientTransport`. Middleware and transport
configuration settings schemas will automatically switch based on the configuration settings schema for the `path`
for each.
"""
schema = {
'middleware': fields.List(
fields.ClassConfigurationSchema(base_class=ClientMiddleware),
description='The list of all `ClientMiddleware` objects that should be applied to requests made from this '
'client to the associated service',
),
'transport': fields.ClassConfigurationSchema(base_class=BaseClientTransport),
} # type: SettingsSchema
defaults = {
'transport': {
'path': 'pysoa.common.transport.redis_gateway.client:RedisClientTransport',
},
} # type: SettingsData