mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
371170eee8
commit
98632f0a87
12 changed files with 58 additions and 14 deletions
|
|
@ -165,6 +165,12 @@ def plugins(all, plugins_dir):
|
|||
)
|
||||
@click.option("--spatialite", is_flag=True, help="Enable SpatialLite extension")
|
||||
@click.option("--version-note", help="Additional note to show on /-/versions")
|
||||
@click.option(
|
||||
"--secret",
|
||||
help="Secret used for signing secure values, such as signed cookies",
|
||||
envvar="DATASETTE_PUBLISH_SECRET",
|
||||
default=lambda: os.urandom(32).hex(),
|
||||
)
|
||||
@click.option(
|
||||
"-p", "--port", default=8001, help="Port to run the server on, defaults to 8001",
|
||||
)
|
||||
|
|
@ -187,6 +193,7 @@ def package(
|
|||
install,
|
||||
spatialite,
|
||||
version_note,
|
||||
secret,
|
||||
port,
|
||||
**extra_metadata
|
||||
):
|
||||
|
|
@ -203,16 +210,17 @@ def package(
|
|||
with temporary_docker_directory(
|
||||
files,
|
||||
"datasette",
|
||||
metadata,
|
||||
extra_options,
|
||||
branch,
|
||||
template_dir,
|
||||
plugins_dir,
|
||||
static,
|
||||
install,
|
||||
spatialite,
|
||||
version_note,
|
||||
extra_metadata,
|
||||
metadata=metadata,
|
||||
extra_options=extra_options,
|
||||
branch=branch,
|
||||
template_dir=template_dir,
|
||||
plugins_dir=plugins_dir,
|
||||
static=static,
|
||||
install=install,
|
||||
spatialite=spatialite,
|
||||
version_note=version_note,
|
||||
secret=secret,
|
||||
extra_metadata=extra_metadata,
|
||||
port=port,
|
||||
):
|
||||
args = ["docker", "build"]
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ def publish_subcommand(publish):
|
|||
install,
|
||||
plugin_secret,
|
||||
version_note,
|
||||
secret,
|
||||
title,
|
||||
license,
|
||||
license_url,
|
||||
|
|
@ -120,6 +121,7 @@ def publish_subcommand(publish):
|
|||
install,
|
||||
spatialite,
|
||||
version_note,
|
||||
secret,
|
||||
extra_metadata,
|
||||
environment_variables,
|
||||
):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from ..utils import StaticMount
|
||||
import click
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
|
|
@ -52,6 +53,12 @@ def add_common_publish_arguments_and_options(subcommand):
|
|||
click.option(
|
||||
"--version-note", help="Additional note to show on /-/versions"
|
||||
),
|
||||
click.option(
|
||||
"--secret",
|
||||
help="Secret used for signing secure values, such as signed cookies",
|
||||
envvar="DATASETTE_PUBLISH_SECRET",
|
||||
default=lambda: os.urandom(32).hex(),
|
||||
),
|
||||
click.option("--title", help="Title for metadata"),
|
||||
click.option("--license", help="License label for metadata"),
|
||||
click.option("--license_url", help="License URL for metadata"),
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ def publish_subcommand(publish):
|
|||
install,
|
||||
plugin_secret,
|
||||
version_note,
|
||||
secret,
|
||||
title,
|
||||
license,
|
||||
license_url,
|
||||
|
|
@ -100,6 +101,7 @@ def publish_subcommand(publish):
|
|||
static,
|
||||
install,
|
||||
version_note,
|
||||
secret,
|
||||
extra_metadata,
|
||||
):
|
||||
app_name = None
|
||||
|
|
@ -144,6 +146,7 @@ def temporary_heroku_directory(
|
|||
static,
|
||||
install,
|
||||
version_note,
|
||||
secret,
|
||||
extra_metadata=None,
|
||||
):
|
||||
extra_metadata = extra_metadata or {}
|
||||
|
|
|
|||
|
|
@ -278,10 +278,13 @@ def make_dockerfile(
|
|||
install,
|
||||
spatialite,
|
||||
version_note,
|
||||
secret,
|
||||
environment_variables=None,
|
||||
port=8001,
|
||||
):
|
||||
cmd = ["datasette", "serve", "--host", "0.0.0.0"]
|
||||
environment_variables = environment_variables or {}
|
||||
environment_variables["DATASETTE_SECRET"] = secret
|
||||
for filename in files:
|
||||
cmd.extend(["-i", filename])
|
||||
cmd.extend(["--cors", "--inspect-file", "inspect-data.json"])
|
||||
|
|
@ -324,7 +327,7 @@ CMD {cmd}""".format(
|
|||
environment_variables="\n".join(
|
||||
[
|
||||
"ENV {} '{}'".format(key, value)
|
||||
for key, value in (environment_variables or {}).items()
|
||||
for key, value in environment_variables.items()
|
||||
]
|
||||
),
|
||||
files=" ".join(files),
|
||||
|
|
@ -348,6 +351,7 @@ def temporary_docker_directory(
|
|||
install,
|
||||
spatialite,
|
||||
version_note,
|
||||
secret,
|
||||
extra_metadata=None,
|
||||
environment_variables=None,
|
||||
port=8001,
|
||||
|
|
@ -381,6 +385,7 @@ def temporary_docker_directory(
|
|||
install,
|
||||
spatialite,
|
||||
version_note,
|
||||
secret,
|
||||
environment_variables,
|
||||
port=port,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue