示例#1
0
class IntegrationConfig:
    """Config type for the integration utilities."""

    broker = var(BrokerConfig)
    payproc = var(DummyPayProcConfig, required=False)
    store = var(DummyStoreConfig, required=False)
    wallet = var(DummyWalletConfig, required=False)
示例#2
0
class WebConfig:

    enable = var(bool, default=False)
    allow_port_reallocation = var(bool, default=True,
                                  required=False)
    bind_address = var(str, default='localhost', required=False)
    bind_port = var(int, default=None, required=False)
示例#3
0
class IntervalConfig:
    """Describes a time interval for a IntervalScheduler."""

    weeks: int = var(required=False)
    days: int = var(required=False)
    hours: int = var(required=False)
    minutes: int = var(required=False)
    seconds: int = var(required=False)
示例#4
0
class WatchConfig:
    """Describes some content to watch."""

    name: str = var()
    type: str = var()
    args: List[str] = var(required=False)
    kwargs: Dict[str, Any] = var(required=False)
    schedule: ScheduleConfig = var()
示例#5
0
class BrokerConfig:
    """Basic broker configuration."""

    "allow listening port reallocation"
    allow_port_reallocation = var(bool, default=True, required=False)
    "start a new broker if true"
    start = var(bool, default=True)
    "broker listening host/interface"
    host = var(str, default='localhost', required=False)
    path = var(str, default=None, required=False)
    "broker listening port"
    port = var(int, default=1883, required=False)
示例#6
0
class DummyStoreConfig:
    """Configuration type for the dummy Store component."""

    @config
    class StoreWebConfig(WebConfig):

        bind_port = var(int, default=8080, required=False)

    web = var(StoreWebConfig, default=StoreWebConfig(), required=False)
示例#7
0
class LogConfig:
    """Describes configuration for logging."""

    dir: str = var(encoder=lambda x: x.to_posix(), decoder=Path)
    level: str = var(default="INFO", decoder=lambda x: x.upper())
    rotation: str = var(default="00:00")
    retention: str = var(default="10 days")
    compression: str = var(default="zip")
    serialize: bool = var(default=True)
    record: bool = var(default=True)
    debug: bool = var(default=False)
示例#8
0
class BrutConfig:
    """Contains observe configuration for the app."""

    db: str = var()
    redis: str = var()
    store: str = var(encoder=lambda x: x.to_posix(), decoder=Path)
    log: LogConfig = var()
    watchers: WatcherConfig = var()
    watch: List[WatchConfig] = var()
    enqueue: ScheduleConfig = var()
示例#9
0
class DummyWalletConfig:

    @config
    class WalletWebConfig(WebConfig):

        bind_port = var(int, default=8082, required=False)

    account = var(str, required=False)
    wallet = var(str, required=False)
    certificate = var(str, required=False)
    interactive = var(bool, default=False, required=False)
    url = var(str, required=False)
    web = var(WalletWebConfig, default=WalletWebConfig(), required=False)
示例#10
0
 def gen_var(att: attr.Attribute) -> attr.Attribute:
     t = att.type
     added_opts = {}
     # take the first not-None type if t is an Union type
     if getattr(t, '__origin__', None) is Union:
         for type_choice in t.__args__: # type: ignore
             # isinstance() cannot be used with typing.*
             if type_choice is not type(None):
                 t = type_choice
                 break
         else:
             raise ValueError(f'Cannot extrapolate valid type from {t!r}')
     # Setup a special encoder/decoder pair for Decimal type that
     # isn't supported directly by (py)YAML
     if t is Decimal:
         added_opts['encoder'] = lambda v: f'{v!s}'
         added_opts['decoder'] = lambda v: Decimal(v)  # type: ignore
     if 'type' not in added_opts:
         added_opts['type'] = t  # type: ignore
     return file_config.var(default=att.default, **added_opts)
示例#11
0
class DummyPayProcConfig:
    """Configuration Type for the dummy PayProc component."""

    DestinationConfig = msg2config(Destination)
    MerchantConfig = msg2config(Merchant)

    @config
    class PayProcWebConfig(WebConfig):

        bind_port = var(int, default=8081, required=False)

    supported_cryptos = var(List[str], unique=True, min=1)
    destinations = var(List[DestinationConfig], min=1)  # type: ignore
    keyfile = var(str)
    certfile = var(str)
    merchant = var(MerchantConfig)
    web = var(PayProcWebConfig, default=PayProcWebConfig(), required=False)
示例#12
0
class WatcherConfig:
    """Describes available watcher configuration."""

    reddit: RedditConfig = var()
示例#13
0
class RedditConfig:
    """Describes configuration necessary for watching reddit."""

    client_id: str = var()
    client_secret: str = var()
    user_agent: str = var()
示例#14
0
class ScheduleConfig:
    """Describes available schedules for an observe entry."""

    crontab: str = var(required=False)
    interval: IntervalConfig = var(required=False)
    immediate: bool = var(default=False)
示例#15
0
    class PayProcWebConfig(WebConfig):

        bind_port = var(int, default=8081, required=False)
示例#16
0
    class StoreWebConfig(WebConfig):

        bind_port = var(int, default=8080, required=False)
示例#17
0
 class TestConfig:
     foo = var(str, default="Default", required=False)
     bar = var(str, default="Default", required=False)
示例#18
0
    class WalletWebConfig(WebConfig):

        bind_port = var(int, default=8082, required=False)
示例#19
0
    class ListCfg:

        foo = var(List[str], unique=True)