working on legacy api:
Teile des Codes aus funktionierendem Projekt kpiert und angepasst, aber noch nicht getestet
This commit is contained in:
@@ -13,6 +13,7 @@ application{
|
||||
|
||||
dependencies{
|
||||
implementation(project(":core"))
|
||||
implementation(project(":legacy"))
|
||||
implementation(project(":translations"))
|
||||
implementation(project(":user"))
|
||||
implementation(project(":web"))
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.sun.net.httpserver.HttpServer;
|
||||
import de.srsoftware.configuration.JsonConfig;
|
||||
import de.srsoftware.tools.ColorLogger;
|
||||
import de.srsoftware.umbrella.core.ConnectionProvider;
|
||||
import de.srsoftware.umbrella.core.UmbrellaException;
|
||||
import de.srsoftware.umbrella.legacy.LegacyApi;
|
||||
import de.srsoftware.umbrella.translations.Translations;
|
||||
import de.srsoftware.umbrella.user.UserModule;
|
||||
import de.srsoftware.umbrella.user.sqlite.SqliteDB;
|
||||
@@ -36,22 +38,24 @@ public class Application {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
public static void main(String[] args) throws IOException, UmbrellaException {
|
||||
LOG.log(INFO, "Starting Umbrella:");
|
||||
var jsonConfig = new JsonConfig(UMBRELLA);
|
||||
configureLogging(jsonConfig);
|
||||
var port = jsonConfig.get("umbrella.http.port", 8080);
|
||||
var threads = jsonConfig.get("umbrella.threads", 16);
|
||||
var userDB = jsonConfig.get("umbrella.database.user", jsonConfig.file().getParent()+"/umbrella.db");
|
||||
var loginDB = jsonConfig.get("umbrella.database.login_services",jsonConfig.file().getParent()+"/umbrella.db");
|
||||
var config = new JsonConfig(UMBRELLA);
|
||||
configureLogging(config);
|
||||
var port = config.get("umbrella.http.port", 8080);
|
||||
var threads = config.get("umbrella.threads", 16);
|
||||
var userDB = config.get("umbrella.database.user", config.file().getParent()+"/umbrella.db");
|
||||
var loginDB = config.get("umbrella.database.login_services",config.file().getParent()+"/umbrella.db");
|
||||
var connectionProvider = new ConnectionProvider();
|
||||
var userDb = new SqliteDB(connectionProvider.get(userDB));
|
||||
var loginServicedb = new SqliteDB(connectionProvider.get(loginDB));
|
||||
var server = HttpServer.create(new InetSocketAddress(port), 0);
|
||||
server.setExecutor(Executors.newFixedThreadPool(threads));
|
||||
new WebHandler().bindPath("/").on(server);
|
||||
new UserModule(userDb,loginServicedb).bindPath("/api/user").on(server);
|
||||
|
||||
new LegacyApi(userDb,config).bindPath("/legacy").on(server);
|
||||
new Translations().bindPath("/api/translations").on(server);
|
||||
new UserModule(userDb,loginServicedb).bindPath("/api/user").on(server);
|
||||
new WebHandler().bindPath("/").on(server);
|
||||
server.start();
|
||||
LOG.log(INFO,"Started web server at {0}",port);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user