Skip to content

Commit

Permalink
Use urlparse to compare interactivetoolsproxy_map with `database_…
Browse files Browse the repository at this point in the history
…connection` and `install_database_connection`

Using `urlparse` rather than `sqlalchemy.engine.make_url` decreases the precision of the comparison, but removes the need to declare `sqlalchemy` as a dependency of the config package.

This is a tradeoff between convenience (preventing mistakes from the user) and complexity (number of dependencies of the config package).
  • Loading branch information
kysrpex committed Sep 3, 2024
1 parent 9ee6636 commit 5c0b5d6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/galaxy/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from urllib.parse import urlparse

import yaml
from sqlalchemy.engine import make_url as parse_sqlalchemy_url

from galaxy.config.schema import AppSchema
from galaxy.exceptions import ConfigurationError
Expand Down Expand Up @@ -1114,7 +1113,7 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None:

# ensure the database URL for the SQLAlchemy map does not match that of a Galaxy DB
urls = {
setting: parse_sqlalchemy_url(value)
setting: urlparse(value)
for setting, value in (
("interactivetoolsproxy_map", self.interactivetoolsproxy_map),
("database_connection", self.database_connection),
Expand All @@ -1124,7 +1123,14 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None:
}

def is_in_conflict(url1, url2):
return all((url1.host == url2.host, url1.port == url2.port, url1.database == url2.database))
return all(
(
url1.scheme == url2.scheme,
url1.hostname == url2.hostname,
url1.port == url2.port,
url1.path == url2.path,
)
)

conflicting_settings = {
setting
Expand Down

0 comments on commit 5c0b5d6

Please sign in to comment.