ensure immutable databses when starting in configuration directory mode with (#1229)

* check if immutables is empty list of None
* update docs on how to create the inspect-data.json
This commit is contained in:
Campbell Allen 2021-03-29 01:17:31 +01:00 committed by GitHub
commit f92d823766
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -213,7 +213,7 @@ class Datasette:
and not inspect_data
):
inspect_data = json.loads((config_dir / "inspect-data.json").read_text())
if immutables is None:
if not immutables:
immutable_filenames = [i["file"] for i in inspect_data.values()]
immutables = [
f for f in self.files if Path(f).name in immutable_filenames

View file

@ -48,7 +48,7 @@ The files that can be included in this directory are as follows. All are optiona
* ``*.db`` - SQLite database files that will be served by Datasette
* ``metadata.json`` - :ref:`metadata` for those databases - ``metadata.yaml`` or ``metadata.yml`` can be used as well
* ``inspect-data.json`` - the result of running ``datasette inspect`` - any database files listed here will be treated as immutable, so they should not be changed while Datasette is running
* ``inspect-data.json`` - the result of running ``datasette inspect *.db --inspect-file=inspect-data.json`` from the configuration directory - any database files listed here will be treated as immutable, so they should not be changed while Datasette is running
* ``settings.json`` - settings that would normally be passed using ``--setting`` - here they should be stored as a JSON object of key/value pairs
* ``templates/`` - a directory containing :ref:`customization_custom_templates`
* ``plugins/`` - a directory containing plugins, see :ref:`writing_plugins_one_off`