Skip to content

Commit

Permalink
remove secho
Browse files Browse the repository at this point in the history
  • Loading branch information
Samk13 committed Nov 22, 2024
1 parent fb44dbe commit 5ebe7db
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions invenio_app_rdm/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

import os

from click import secho


def build_db_uri():
"""Build the database URI."""
Expand All @@ -23,18 +21,12 @@ def build_db_uri():

if all(params.values()):
uri = f"postgresql+psycopg2://{params['user']}:{params['password']}@{params['host']}:{params['port']}/{params['name']}"
secho(
f"Constructed database URI: '{params['user']}:***@{params['host']}:{params['port']}/{params['name']}'",
fg="blue",
)
return uri

uri = os.environ.get("SQLALCHEMY_DATABASE_URI")
if uri:
secho(f"Using SQLALCHEMY_DATABASE_URI: '{uri}'", fg="blue")
return uri

secho(f"Falling back to the default URI: '{DEFAULT_URI}'", fg="blue")
return DEFAULT_URI


Expand All @@ -48,18 +40,12 @@ def build_broker_url():

if all(params.values()):
uri = f"amqp://{params['user']}:{params['password']}@{params['host']}:{params['port']}/"
secho(
f"Constructed AMQP URL: '{params['user']}:***@{params['host']}:{params['port']}/'",
fg="blue",
)
return uri

uri = os.environ.get("BROKER_URL")
if uri:
secho(f"AMQP URI: '{uri}'", fg="blue")
return uri

secho(f"Falling back to the default URI: '{DEFAULT_BROKER_URL}'", fg="blue")
return DEFAULT_BROKER_URL


Expand All @@ -74,13 +60,10 @@ def build_redis_url(db=None):
if redis_host and redis_port:
password = f":{redis_password}@" if redis_password else ""
uri = f"redis://{password}{redis_host}:{redis_port}/{db}"
secho(f"Constructed Redis URL: '{uri}'", fg="blue")
return uri

uri = os.environ.get("BROKER_URL")
if uri and uri.startswith(("redis://", "rediss://", "unix://")):
secho(f"Using Redis BROKER_URL: '{uri}'", fg="blue")
return uri

secho(f"Falling back to the default Redis URL: '{DEFAULT_BROKER_URL}'", fg="blue")
return DEFAULT_BROKER_URL

0 comments on commit 5ebe7db

Please sign in to comment.