[docs]classBaseEndpointSettings(Configurable):#: endpoint name, used as an unique identifiername:str#: port to listen onport:Optional[int]=None#: description, informative onlydescription:Optional[str]=None
[docs]classEndpointSettings(BaseEndpointSettings):""" Configuration parser for ``proxy.endpoints[]`` settings. .. code-block:: yaml name: my-endpoint port: 8080 description: My endpoint remote: # see HttpRemote ... controller : optional controller Service definition, default to HttpProxyController A shorthand syntax is also available for cases where you only need to proxy to a single URL and do not require fine-tuning the endpoint settings: .. code-block:: yaml name: my-endpoint port: 8080 description: My endpoint url: http://my-endpoint:8080 """#: remote definition, with url pools, probes, etc.remote:Optional[RemoteSettings]=Field(None,repr=False)#: custom controllercontroller:Optional[Service|str]=Service(type="harp_apps.proxy.controllers.HttpProxyController",arguments={"dispatcher":LazyService(type="IAsyncEventDispatcher")},)@model_validator(mode="before")@classmethoddef__prepare(cls,values):# Convert old school urls into new style remotesif"url"invaluesandvalues["url"]isnotNone:if"remote"invaluesandvalues["remote"]isnotNone:raiseValueError("You can't define both proxy.endpoints[].remote and proxy.endpoints[].url, the second one is just ""a historical shorthand syntax for the first one.")values["remote"]=RemoteSettings(endpoints=[RemoteEndpointSettings(url=values.pop("url"))])if"controller"invaluesandisinstance(values["controller"],str):values["controller"]=Service(type=values["controller"])returnvalues