Skip to content

Commit

Permalink
Prevent DB connection when building docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eudoxos committed Nov 7, 2023
1 parent 054e54e commit 2084b72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


# for readthedocs.org, don't try to connect to the DB when importing mupifDB.api.main
import os
os.environ['MUPIFDB_DRY_RUN']='1'

# Generate OpenAPI json description prior to running sphinx
#
Expand Down
5 changes: 4 additions & 1 deletion mupifDB/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@
# import and initialize EDM
if 1:
import mupifDB.api.edm as edm
edm.initializeEdm(client)
# when imported at readthedocs, don't try to connect to the DB (no DB running there)
if not 'MUPIFDB_DRY_RUN' in os.environ:
edm.initializeEdm(client)
else: print('MUPIFDB_DRY_RUN defined, not initializing EDM DB connection.')
app.include_router(edm.dms3.router)


Expand Down

0 comments on commit 2084b72

Please sign in to comment.