소스 검색

check table even if db connection is ok

tags/2.0.1
Jonathan Cobb 4 년 전
부모
커밋
b53f5d1c49
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. +7
    -4
      wizard-server/src/main/java/org/cobbzilla/wizard/server/listener/SystemInitializerListener.java

+ 7
- 4
wizard-server/src/main/java/org/cobbzilla/wizard/server/listener/SystemInitializerListener.java 파일 보기

@@ -39,11 +39,12 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {

try {
config.execSql("select 1");
checkTable(config);
log.info("database configured OK, skipping initialization");
return;

} catch (Exception e) {
log.warn(PREFIX+"database not configured, attempting to initialize...");
log.warn(PREFIX+"database not properly configured, attempting to initialize...");
}

try {
@@ -84,7 +85,11 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {
die(PREFIX+"database configuration failed, cannot run test query: "+shortError(e));
}

// does a proper table exist?
checkTable(config);
super.beforeStart(server);
}

public void checkTable(PgRestServerConfiguration config) {
if (!empty(checkTable)) {
if (!checkSafeShellArg(checkTable)) invalidName("invalid table name", checkTable);
try {
@@ -94,8 +99,6 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {
config.getDatabase().getHibernate().setHbm2ddlAuto("create");
}
}

super.beforeStart(server);
}

@Override public void onStart(RestServer server) {


불러오는 중...
취소
저장