Skip to content

Commit

Permalink
fix: http handler endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dvilelaf committed Jun 7, 2024
1 parent 665bfa7 commit 6196e39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/dvilela/agents/tsunami/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ models:
suno_enabled: ${bool:true}
telegram_token: ${str:null}
telegram_chat_id: ${int:null}
service_endpoint: ${str:https://tsunami.dummy.com/}
---
public_id: valory/http_server:0.22.0:bafybeicblltx7ha3ulthg7bzfccuqqyjmihhrvfeztlgrlcoxhr7kf6nbq
type: connection
Expand Down
11 changes: 5 additions & 6 deletions packages/dvilela/skills/tsunami_abci/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,11 @@ def setup(self) -> None:
config_uri_base_hostname = urlparse(
self.context.params.service_endpoint
).hostname
propel_uri_base_hostname = (
r"https?:\/\/[a-zA-Z0-9]{16}.agent\.propel\.(staging\.)?autonolas\.tech"
)

# Route regexes
hostname_regex = rf".*({config_uri_base_hostname}|{propel_uri_base_hostname}|localhost|127.0.0.1|0.0.0.0)(:\d+)?"
hostname_regex = (
rf".*({config_uri_base_hostname}|localhost|127.0.0.1|0.0.0.0)(:\d+)?"
)
self.handler_url_regex = ( # pylint: disable=attribute-defined-outside-init
rf"{hostname_regex}\/.*"
)
Expand Down Expand Up @@ -174,7 +173,7 @@ def _get_handler(self, url: str, method: str) -> Tuple[Optional[Callable], Dict]
# Check base url
if not re.match(self.handler_url_regex, url):
self.context.logger.info(
f"The url {url} does not match the DynamicNFT HttpHandler's pattern"
f"The url {url} does not match the HttpHandler's pattern: {self.handler_url_regex}"
)
return None, {}

Expand All @@ -191,7 +190,7 @@ def _get_handler(self, url: str, method: str) -> Tuple[Optional[Callable], Dict]

# No route found
self.context.logger.info(
f"The message [{method}] {url} is intended for the DynamicNFT HttpHandler but did not match any valid pattern"
f"The message [{method}] {url} is intended for the HttpHandler but did not match any valid pattern"
)
return self._handle_bad_request, {}

Expand Down

0 comments on commit 6196e39

Please sign in to comment.