| 
167 | 167 | )  | 
168 | 168 | from werkzeug.local import LocalProxy  | 
169 | 169 | 
 
  | 
 | 170 | +from invenio_config.env import build_broker_url, build_db_uri, build_redis_url  | 
 | 171 | + | 
170 | 172 | from .theme.views import notification_settings  | 
171 | 173 | from .users.schemas import NotificationsUserSchema, UserPreferencesNotificationsSchema  | 
172 | 174 | 
 
  | 
@@ -214,7 +216,7 @@ def _(x):  | 
214 | 216 | # =============  | 
215 | 217 | # https://flask-limiter.readthedocs.io/en/stable/#configuration  | 
216 | 218 | 
 
  | 
217 |  | -RATELIMIT_STORAGE_URI = "redis://localhost:6379/3"  | 
 | 219 | +RATELIMIT_STORAGE_URI = build_redis_url(db=3)  | 
218 | 220 | """Storage for ratelimiter."""  | 
219 | 221 | 
 
  | 
220 | 222 | # Increase defaults  | 
@@ -380,7 +382,7 @@ def files_rest_permission_factory(obj, action):  | 
380 | 382 | # See https://invenio-accounts.readthedocs.io/en/latest/configuration.html  | 
381 | 383 | # See https://flask-security.readthedocs.io/en/3.0.0/configuration.html  | 
382 | 384 | 
 
  | 
383 |  | -ACCOUNTS_SESSION_REDIS_URL = "redis://localhost:6379/1"  | 
 | 385 | +ACCOUNTS_SESSION_REDIS_URL = build_redis_url(db=1)  | 
384 | 386 | """Redis session storage URL."""  | 
385 | 387 | 
 
  | 
386 | 388 | ACCOUNTS_USERINFO_HEADERS = True  | 
@@ -413,7 +415,7 @@ def files_rest_permission_factory(obj, action):  | 
413 | 415 | # See docs.celeryproject.org/en/latest/userguide/configuration.html  | 
414 | 416 | # See https://flask-celeryext.readthedocs.io/en/latest/  | 
415 | 417 | 
 
  | 
416 |  | -BROKER_URL = "amqp://guest:guest@localhost:5672/"  | 
 | 418 | +BROKER_URL = build_broker_url()  | 
417 | 419 | """URL of message broker for Celery 3 (default is RabbitMQ)."""  | 
418 | 420 | 
 
  | 
419 | 421 | CELERY_BEAT_SCHEDULE = {  | 
@@ -487,16 +489,14 @@ def files_rest_permission_factory(obj, action):  | 
487 | 489 | CELERY_BROKER_URL = BROKER_URL  | 
488 | 490 | """Same as BROKER_URL to support Celery 4."""  | 
489 | 491 | 
 
  | 
490 |  | -CELERY_RESULT_BACKEND = "redis://localhost:6379/2"  | 
 | 492 | +CELERY_RESULT_BACKEND = build_redis_url(db=2)  | 
491 | 493 | """URL of backend for result storage (default is Redis)."""  | 
492 | 494 | 
 
  | 
493 | 495 | # Flask-SQLAlchemy  | 
494 | 496 | # ================  | 
495 | 497 | # See https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/  | 
496 | 498 | 
 
  | 
497 |  | -SQLALCHEMY_DATABASE_URI = (  | 
498 |  | -    "postgresql+psycopg2://invenio-app-rdm:invenio-app-rdm@localhost/invenio-app-rdm"  | 
499 |  | -)  | 
 | 499 | +SQLALCHEMY_DATABASE_URI = build_db_uri()  | 
500 | 500 | """Database URI including user and password.  | 
501 | 501 | 
  | 
502 | 502 | Default value is provided to make module testing easier.  | 
@@ -688,7 +688,7 @@ def files_rest_permission_factory(obj, action):  | 
688 | 688 | # =============  | 
689 | 689 | # See https://flask-caching.readthedocs.io/en/latest/index.html#configuring-flask-caching  # noqa  | 
690 | 690 | 
 
  | 
691 |  | -CACHE_REDIS_URL = "redis://localhost:6379/0"  | 
 | 691 | +CACHE_REDIS_URL = build_redis_url()  | 
692 | 692 | """URL to connect to Redis server."""  | 
693 | 693 | 
 
  | 
694 | 694 | CACHE_TYPE = "flask_caching.backends.redis"  | 
 | 
0 commit comments