From cfe90653acd794902ffe4644f8b1c0212ffad079 Mon Sep 17 00:00:00 2001 From: Alex Garcia Date: Wed, 6 Sep 2023 09:02:50 -0700 Subject: [PATCH 1/3] If not --internal flag is passed but $DATASETTE_INTERNAL_DB_PATH is defined, then use that --- datasette/app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/datasette/app.py b/datasette/app.py index 0227f6276b..b1630122f3 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -310,6 +310,9 @@ def __init__( Database(self, file, is_mutable=file not in self.immutables) ) + if internal is None and "DATASETTE_INTERNAL_DB_PATH" in os.environ: + internal = os.environ.get("DATASETTE_INTERNAL_DB_PATH") + self.internal_db_created = False if internal is None: self._internal_database = Database(self, memory_name=secrets.token_hex()) From 49098b9b2f3b6b4d831174a3eeb223a5ba380ccd Mon Sep 17 00:00:00 2001 From: Alex Garcia Date: Thu, 7 Sep 2023 17:01:03 -0700 Subject: [PATCH 2/3] DATASETTE_INTERNAL, uses click --- datasette/app.py | 3 --- datasette/cli.py | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/datasette/app.py b/datasette/app.py index b1630122f3..0227f6276b 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -310,9 +310,6 @@ def __init__( Database(self, file, is_mutable=file not in self.immutables) ) - if internal is None and "DATASETTE_INTERNAL_DB_PATH" in os.environ: - internal = os.environ.get("DATASETTE_INTERNAL_DB_PATH") - self.internal_db_created = False if internal is None: self._internal_database = Database(self, memory_name=secrets.token_hex()) diff --git a/datasette/cli.py b/datasette/cli.py index 1a5a8af34c..f3ea7d0440 100644 --- a/datasette/cli.py +++ b/datasette/cli.py @@ -477,6 +477,7 @@ def uninstall(packages, yes): "--internal", type=click.Path(), help="Path to a persistent Datasette internal SQLite database", + envvar="DATASETTE_INTERNAL" ) def serve( files, From d75b51950f6836d6e5a58accb48b1d7687dbdd1c Mon Sep 17 00:00:00 2001 From: Alex Garcia Date: Thu, 7 Sep 2023 17:32:22 -0700 Subject: [PATCH 3/3] black --- datasette/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasette/cli.py b/datasette/cli.py index f3ea7d0440..590d03f866 100644 --- a/datasette/cli.py +++ b/datasette/cli.py @@ -477,7 +477,7 @@ def uninstall(packages, yes): "--internal", type=click.Path(), help="Path to a persistent Datasette internal SQLite database", - envvar="DATASETTE_INTERNAL" + envvar="DATASETTE_INTERNAL", ) def serve( files,