mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
/-/config page, closes #2254
This commit is contained in:
parent
85a1dfe6e0
commit
1e901aa690
5 changed files with 84 additions and 23 deletions
|
|
@ -81,6 +81,7 @@ from .utils import (
|
|||
tilde_decode,
|
||||
to_css_class,
|
||||
urlsafe_components,
|
||||
redact_keys,
|
||||
row_sql_params_pks,
|
||||
)
|
||||
from .utils.asgi import (
|
||||
|
|
@ -1374,6 +1375,11 @@ class Datasette:
|
|||
output.append(script)
|
||||
return output
|
||||
|
||||
def _config(self):
|
||||
return redact_keys(
|
||||
self.config, ("secret", "key", "password", "token", "hash", "dsn")
|
||||
)
|
||||
|
||||
def _routes(self):
|
||||
routes = []
|
||||
|
||||
|
|
@ -1433,12 +1439,8 @@ class Datasette:
|
|||
r"/-/settings(\.(?P<format>json))?$",
|
||||
)
|
||||
add_route(
|
||||
permanent_redirect("/-/settings.json"),
|
||||
r"/-/config.json",
|
||||
)
|
||||
add_route(
|
||||
permanent_redirect("/-/settings"),
|
||||
r"/-/config",
|
||||
JsonDataView.as_view(self, "config.json", lambda: self._config()),
|
||||
r"/-/config(\.(?P<format>json))?$",
|
||||
)
|
||||
add_route(
|
||||
JsonDataView.as_view(self, "threads.json", self._threads),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue