Attention
This is the documentation for HARP Proxy, actually published as an early preview. Both the software and documentation are a work in progress, and although we already use it on various production servers, they may contain inaccuracies, typographical errors, huge mistakes and empty pages. We work hard to eradicate all mistakes and implement stuff, but it is a long and tedious process. We appreciate your patience and understanding. Of course, any help will be greatly appreciated.
Config (harp.config)¶
The Config (harp.config
) module provides tools to configure Applications.
Applications are standard python packages that contains specific definitions to be able to register services and configure themselves. Every feature of Harp is built as an application, and you will want to write applications if you want to extend harp’s functionality for specific needs.
Contents¶
- class Application[source]¶
Bases:
object
Base class for writing harp applications, which are basically python packages with auto-registration superpowers.
TODO: - use settings instead of settings_type, with type annotation ? - namespace instead of settings namespace ? autodetect from settings ?
- register_events(dispatcher)[source]¶
- Parameters:
dispatcher (IAsyncEventDispatcher)
- name = None¶
- on_bind = None¶
Placeholder for factory bind event, happening before the container is built. If set, it will be attached to the factory dispatcher automatically.
- on_bound = None¶
Placeholder for factory bound event, happening after the container is built. If set, it will be attached to the factory dispatcher automatically.
- on_build = None¶
Placeholder for factory build event, happening after the kernel is built. If set, it will be attached to the factory dispatcher automatically.
- settings_namespace = None¶
- settings_type = None¶
- class Config[source]¶
Bases:
object
- read_env(options, /)[source]¶
Parses sys.argv-like arguments.
- Parameters:
args
files – list of filenames to load in order. Will happen after defaults env and files.
options (CommonServerOptions)
- Returns:
argparse.Namespace
- register_events(dispatcher)[source]¶
- Parameters:
dispatcher (IAsyncEventDispatcher)
- DEFAULT_APPLICATIONS = ['http_client', 'proxy', 'dashboard', 'sqlalchemy_storage', 'telemetry', 'janitor', 'harp_apps.contrib.sentry']¶
- property applications¶
- property settings¶
- class Definition[source]¶
Bases:
Generic
[T
]Definition(*, path: str, name: str, args: Optional[Tuple] = None, kwargs: Optional[Mapping] = None)
- __init__(*, path, name, args=None, kwargs=None)¶
- to_dict(*, secure=True)¶
- property factory¶
- property module¶
- property spec¶
- class DisableableBaseSettings[source]¶
Bases:
BaseSetting
DisableableBaseSettings(**kwargs)
- class DisabledSettings[source]¶
Bases:
BaseSetting
- class FromFileSetting[source]¶
Bases:
BaseSetting
FromFileSetting(from_file: str)
- settings_dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False)¶
Add dunder methods based on the fields defined in the class.
Examines PEP 526 __annotations__ to determine fields.
If init is true, an __init__() method is added to the class. If repr is true, a __repr__() method is added. If order is true, rich comparison dunder methods are added. If unsafe_hash is true, a __hash__() method is added. If frozen is true, fields may not be assigned to after instance creation. If match_args is true, the __match_args__ tuple is added. If kw_only is true, then by default all fields are keyword-only. If slots is true, a new class with a __slots__ attribute is returned.