This commit is contained in:
kento2 2026-07-05 03:06:15 +02:00
parent ea6ae529cc
commit 7040a6ce1e
20 changed files with 135 additions and 83 deletions

View file

@ -25,6 +25,9 @@ dependencies {
// https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine
implementation("com.github.ben-manes.caffeine:caffeine:3.2.4")
// https://mvnrepository.com/artifact/org.postgresql/postgresql
implementation("org.postgresql:postgresql:42.7.12")
}
tasks.build {

View file

@ -13,6 +13,7 @@ import lombok.NoArgsConstructor;
import org.jdbi.v3.core.Jdbi;
import java.io.IOException;
import java.util.Properties;
@NoArgsConstructor(access = AccessLevel.NONE)
public class ScrowAPISurface {
@ -30,7 +31,14 @@ public class ScrowAPISurface {
}
if (enableDatabase) {
ScrowAPI.setJdbi(Jdbi.create(EnvUtils.envOrThrow("HOST_POSTGRES")));
try {
Class.forName("org.postgresql.Driver", true, ScrowAPISurface.class.getClassLoader());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
var props = new Properties();
props.setProperty("user", "postgres");
ScrowAPI.setJdbi(Jdbi.create(EnvUtils.envOrThrow("HOST_POSTGRES"), props));
}
ScrowAPI.setInstanceManager(new InstanceManagerImpl(ScrowAPI.getMessageBroker()));