* Migrated ur an sqlite database

* Removed unnecessary IOExceptions

* Removed an util class not needed anymore

* Updated README.md and docker-compose.yml to reflect new storage mechanism

* This change was not meant for this branch

* Port change with environment variable

* Unused imports

* Updated README.md

* Added basic protection against duplication
This commit is contained in:
Przemek Dragańczuk
2020-05-23 19:16:27 +02:00
committed by GitHub
parent 425b8a5f44
commit 218f2fa368
4 changed files with 19 additions and 11 deletions

View File

@@ -1,7 +1,5 @@
package tk.draganczuk.url;
import spark.Filter;
import static spark.Spark.*;
public class App {
@@ -17,13 +15,13 @@ public class App {
staticFiles.location("/public");
}
port(Integer.parseInt(System.getProperty("port", "4567")));
port(Integer.parseInt(System.getenv().getOrDefault("port", "4567")));
// Add GZIP compression
after(Filters::addGZIP);
// No need to auth in dev
if(System.getenv("dev") == null) {
if (System.getenv("dev") == null) {
// Authenticate
before("/api/*", Filters.createAuthFilter());
}

View File

@@ -4,8 +4,6 @@ import org.eclipse.jetty.http.HttpStatus;
import spark.Request;
import spark.Response;
import java.io.IOException;
public class Routes {
private static UrlRepository urlRepository;

View File

@@ -1,10 +1,5 @@
package tk.draganczuk.url;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;