Refactor API structure and enhance logging/debugging.
Modularized OpenAPI definitions by splitting into dedicated files for teams, bans, and errors. Improved backend logging for database connections, CORS configuration, and debugging. Updated application properties to support environment-specific CORS origins and logging levels.
This commit is contained in:
@@ -42,16 +42,20 @@ public class Connection {
|
||||
}
|
||||
CompletableFuture<DatabaseSettings> settingsFuture = new CompletableFuture<>();
|
||||
getConnection(Databases.DEFAULT, (mapper -> mapper.addMapper(SettingsMapper.class))).thenApply(connection -> {
|
||||
log.debug("Loading settings for database {}", database.getInternalName());
|
||||
connection.runQuery(session -> {
|
||||
log.debug("Running query to load settings for database");
|
||||
DatabaseSettings loadedSettings = session.getMapper(SettingsMapper.class).getSettings(database.getInternalName());
|
||||
if (loadedSettings == null) {
|
||||
log.error("Failed to load settings for database {}", database.getInternalName());
|
||||
}
|
||||
log.debug("Loaded settings {}", loadedSettings);
|
||||
settingsFuture.complete(loadedSettings);
|
||||
});
|
||||
return null;
|
||||
});
|
||||
return settingsFuture.thenApply(loadedSettings -> {
|
||||
log.debug("Storing connection for database {}", database.getInternalName());
|
||||
Connection connection = new Connection(loadedSettings, addMappers);
|
||||
connections.put(database, connection);
|
||||
return connection;
|
||||
@@ -66,7 +70,9 @@ public class Connection {
|
||||
System.getenv("DB_USER"),
|
||||
System.getenv("DB_PASS")
|
||||
);
|
||||
log.debug("Loaded default database settings {}", databaseSettings);
|
||||
Connection connection = new Connection(databaseSettings, addMappers);
|
||||
log.debug("Created default database connection {}", connection);
|
||||
return CompletableFuture.completedFuture(connection);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user