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) {
let repo = "";
if (event.path === "/") {
repo = "/authentik";
} else if (event.path.startsWith("/api")) {
repo = "/client-go";
if (event.path.startsWith("/api")) {
repo = "client-go";
} else if (event.path.startsWith("/terraform-provider-authentik")) {
repo = "terraform-provider-authentik";
} else {
repo = event.path;
repo = "authentik";
}
return {
statusCode: 200,
headers: {
"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}">`,
};
};