Skip to content

Commit

Permalink
add skip db on weaver build docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Jun 5, 2020
1 parent 3b5ea3b commit 166c85b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def doc_redirect_include(file_path):
})

# generate openapi
config = Configurator(settings={"weaver.wps": False, "weaver.wps_restapi": True})
config = Configurator(settings={"weaver.wps": False, "weaver.wps_restapi": True, "weaver.build_docs": True})
config.include("weaver") # need to include package to apply decorators and parse routes
api_spec_file = os.path.join(DOC_BLD_ROOT, "api.json")
api_spec_json = get_swagger_json(http_host="example", http_scheme="https")
Expand Down
9 changes: 8 additions & 1 deletion weaver/database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import logging
from typing import TYPE_CHECKING

from weaver.utils import get_registry
from pyramid.settings import asbool

from weaver.utils import get_registry, get_settings

LOGGER = logging.getLogger(__name__)
if TYPE_CHECKING:
Expand All @@ -16,6 +18,11 @@ def get_db(container):


def includeme(config):
settings = get_settings(config)
if asbool(settings.get("weaver.build_docs", True)):
LOGGER.info("Skipping database when building docs...")
return

LOGGER.info("Adding database...")
from weaver.database.mongodb import MongoDatabase
config.registry.db = MongoDatabase(config.registry)
Expand Down

0 comments on commit 166c85b

Please sign in to comment.