Coder Social home page Coder Social logo

Comments (5)

simonw avatar simonw commented on September 23, 2024

I can reuse /-/config which I setup to redirect to /-/settings a while ago:

datasette/datasette/app.py

Lines 1431 to 1442 in 85a1dfe

add_route(
JsonDataView.as_view(self, "settings.json", lambda: self._settings),
r"/-/settings(\.(?P<format>json))?$",
)
add_route(
permanent_redirect("/-/settings.json"),
r"/-/config.json",
)
add_route(
permanent_redirect("/-/settings"),
r"/-/config",
)

from datasette.

simonw avatar simonw commented on September 23, 2024

For /-/metadata I got so paranoid about accidentally leaking configured secrets that I invented that weird https://docs.datasette.io/en/stable/plugins.html#secret-configuration-values syntax:

{
    "plugins": {
        "datasette-auth-github": {
            "client_secret": {
                "$env": "GITHUB_CLIENT_SECRET"
            }
        }
    }
}

For /-/config I'm going to go with a simpler approach: I'm going to automatically redact any keys with _secret or _token or _key in them.

from datasette.

simonw avatar simonw commented on September 23, 2024

datasette-sentry has dsn which should be redacted too.

from datasette.

simonw avatar simonw commented on September 23, 2024

Now live:

from datasette.

simonw avatar simonw commented on September 23, 2024

I'm regretting using permanent_redirect() for the old /-/config page now - my Firefox STILL follows that redirect when I click on https://latest.datasette.io/-/config several hours after I shipped this change.

datasette/datasette/app.py

Lines 1868 to 1881 in 5d21057

def permanent_redirect(path, forward_query_string=False, forward_rest=False):
return wrap_view(
lambda request, send: Response.redirect(
path
+ (request.url_vars["rest"] if forward_rest else "")
+ (
("?" + request.query_string)
if forward_query_string and request.query_string
else ""
),
status=301,
),
datasette=None,
)

from datasette.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.