Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from datasette import hookimpl
from datasette.utils.asgi import Response
import os
REDACT = {"GPG_KEY"}
async def env(request):
output = []
for key, value in os.environ.items():
if key not in REDACT:
output.append("{}={}".format(key, value))
return Response.text("\n".join(output))
@hookimpl
def register_routes():
return [
(r"^/-/env$", env)
]
from setuptools import setup
VERSION = "0.1"
setup(
name="datasette-expose-some-environment-variables",
description="Expose environment variables in Datasette at /-/env",
author="Simon Willison",
license="Apache License, Version 2.0",
version=VERSION,
py_modules=["datasette_expose_some_environment_variables"],
entry_points={
"datasette": [
"expose_some_environment_variables = datasette_expose_some_environment_variables"
]
},
install_requires=["datasette"],
)
@simonw
Copy link
Author

simonw commented May 25, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment