website: fix go-get function (always fallback to authentik repo except hardcoded values) (#5767)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-05-26 17:46:01 +02:00 committed by GitHub
parent a8067c1f0d
commit 60e911baf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -2,18 +2,18 @@ const gitHubNamespace = "goauthentik";
exports.handler = async function (event, context) { exports.handler = async function (event, context) {
let repo = ""; let repo = "";
if (event.path === "/") { if (event.path.startsWith("/api")) {
repo = "/authentik"; repo = "client-go";
} else if (event.path.startsWith("/api")) { } else if (event.path.startsWith("/terraform-provider-authentik")) {
repo = "/client-go"; repo = "terraform-provider-authentik";
} else { } else {
repo = event.path; repo = "authentik";
} }
return { return {
statusCode: 200, statusCode: 200,
headers: { headers: {
"content-type": "text/html", "content-type": "text/html",
}, },
body: `<meta name="go-import" content="${event.headers.host}${event.path} git https://github.com/${gitHubNamespace}${repo}">`, body: `<meta name="go-import" content="${event.headers.host}${event.path} git https://github.com/${gitHubNamespace}/${repo}">`,
}; };
}; };