Allow setting site_url

This commit is contained in:
SinTan1729
2022-11-10 20:17:39 -06:00
parent e2656ff94e
commit deeba64e74
5 changed files with 45 additions and 10 deletions

View File

@@ -36,6 +36,7 @@ public class App {
get("/all", Routes::getAll);
post("/new", Routes::addUrl);
delete("/:shortUrl", Routes::delete);
get("/siteUrl", Routes::siteUrl);
});
get("/:shortUrl", Routes::goToLongUrl);

View File

@@ -42,6 +42,10 @@ public class Routes {
}
}
public static String siteUrl(Request req, Response res) {
return System.getenv().getOrDefault("site_url", "unset");
}
public static String goToLongUrl(Request req, Response res) {
String shortUrl = req.params("shortUrl");