fix(shared): fix missing port in public_url
This commit is contained in:
parent
f24996e144
commit
ba0897a023
|
@ -105,7 +105,7 @@ class GeneralConfig(BaseModel):
|
||||||
|
|
||||||
protocol: str = "http"
|
protocol: str = "http"
|
||||||
base_url: str = "localhost"
|
base_url: str = "localhost"
|
||||||
base_port: int = 80
|
base_port: Optional[int]
|
||||||
base_dir: str = "/"
|
base_dir: str = "/"
|
||||||
force_ssl: bool = False
|
force_ssl: bool = False
|
||||||
|
|
||||||
|
@ -113,8 +113,13 @@ class GeneralConfig(BaseModel):
|
||||||
def public_url(self) -> str:
|
def public_url(self) -> str:
|
||||||
scheme = "https" if self.force_ssl else self.protocol
|
scheme = "https" if self.force_ssl else self.protocol
|
||||||
|
|
||||||
url = urlunsplit((scheme, self.base_url, self.base_dir, None, None))
|
location = self.base_url
|
||||||
return url.rstrip("/")
|
if self.base_port is not None:
|
||||||
|
location += f":{self.base_port}"
|
||||||
|
|
||||||
|
path = self.base_dir.rstrip("/")
|
||||||
|
|
||||||
|
return urlunsplit((scheme, location, path, None, None))
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
Loading…
Reference in New Issue