mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-01-04 01:46:54 +10:00
feat: Patch setup_django so we can use an inmemory db in specific commands
This commit is contained in:
committed by
Cristian Vargas
parent
35a5700c73
commit
9aac09a5e1
@@ -19,6 +19,8 @@ meta_cmds = ('help', 'version')
|
||||
main_cmds = ('init', 'info', 'config')
|
||||
archive_cmds = ('add', 'remove', 'update', 'list', 'status')
|
||||
|
||||
fake_db = ("oneshot",) + meta_cmds
|
||||
|
||||
display_first = (*meta_cmds, *main_cmds, *archive_cmds)
|
||||
|
||||
# every imported command module must have these properties in order to be valid
|
||||
@@ -59,7 +61,7 @@ def run_subcommand(subcommand: str,
|
||||
pwd: Union[Path, str, None]=None) -> None:
|
||||
"""Run a given ArchiveBox subcommand with the given list of args"""
|
||||
from ..config import setup_django
|
||||
setup_django()
|
||||
setup_django(in_memory_db=subcommand in fake_db)
|
||||
|
||||
module = import_module('.archivebox_{}'.format(subcommand), __package__)
|
||||
module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user