mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
--version-note for datasette, datasette publish and datasette package
This is a relatively obscure new command-line argument that helps solve the
problem of showing accurate version information in deployed instances of
Datasette even if they were deployed directly from source code.
You can pass --version-note to datasette publish and package and it will then
in turn be passed to datasette when it starts:
datasette --version-note=hello fixtures.db
Now if you visit /-/versions.json you will see this:
{
"datasette": {
"note": "hello",
"version": "0+unknown"
},
"python": {
"full": "3.6.5 (default, Jun 6 2018, 19:19:24) \n[GCC 6.3.0 20170516]",
"version": "3.6.5"
},
...
}
I plan to use this in some Travis CI configuration, refs #313
This commit is contained in:
parent
538565de3a
commit
db1e6bc182
5 changed files with 24 additions and 3 deletions
|
|
@ -241,7 +241,7 @@ def escape_sqlite(s):
|
|||
return '[{}]'.format(s)
|
||||
|
||||
|
||||
def make_dockerfile(files, metadata_file, extra_options, branch, template_dir, plugins_dir, static, install, spatialite):
|
||||
def make_dockerfile(files, metadata_file, extra_options, branch, template_dir, plugins_dir, static, install, spatialite, version_note):
|
||||
cmd = ['"datasette"', '"serve"', '"--host"', '"0.0.0.0"']
|
||||
cmd.append('"' + '", "'.join(files) + '"')
|
||||
cmd.extend(['"--cors"', '"--port"', '"8001"', '"--inspect-file"', '"inspect-data.json"'])
|
||||
|
|
@ -251,6 +251,8 @@ def make_dockerfile(files, metadata_file, extra_options, branch, template_dir, p
|
|||
cmd.extend(['"--template-dir"', '"templates/"'])
|
||||
if plugins_dir:
|
||||
cmd.extend(['"--plugins-dir"', '"plugins/"'])
|
||||
if version_note:
|
||||
cmd.extend(['"--version-note"', '"{}"'.format(version_note)])
|
||||
if static:
|
||||
for mount_point, _ in static:
|
||||
cmd.extend(['"--static"', '"{}:{}"'.format(mount_point, mount_point)])
|
||||
|
|
@ -293,6 +295,7 @@ def temporary_docker_directory(
|
|||
static,
|
||||
install,
|
||||
spatialite,
|
||||
version_note,
|
||||
extra_metadata=None
|
||||
):
|
||||
extra_metadata = extra_metadata or {}
|
||||
|
|
@ -324,6 +327,7 @@ def temporary_docker_directory(
|
|||
static,
|
||||
install,
|
||||
spatialite,
|
||||
version_note,
|
||||
)
|
||||
os.chdir(datasette_dir)
|
||||
if metadata_content:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue