Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

🤢 blade is compatible with the old version #233

Merged
merged 1 commit into from
Sep 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/main/java/com/tale/init/SqliteJdbc.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ public static void importSql(boolean devMode) {
DB_PATH = Const.CLASSPATH + File.separatorChar + DB_NAME;
DB_SRC = "jdbc:sqlite://" + DB_PATH;

System.out.println("CLASSPATH: " + Const.CLASSPATH);
System.out.println("DB_PATH: " + DB_PATH);

if (devMode) {
DB_PATH = System.getProperty("user.dir") + "/" + DB_NAME;
DB_SRC = "jdbc:sqlite://" + DB_PATH;
}

LOGGER.info("blade dev mode: {}", devMode);
LOGGER.info("load sqlite database path [{}]", DB_PATH);
LOGGER.info("load sqlite database src [{}]", DB_SRC);

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/tale/init/WebContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ public class WebContext implements BeanProcessor {
public void preHandle(Blade blade) {
Ioc ioc = blade.ioc();

boolean devMode = blade.environment().getBoolean("app.devMode", blade.environment().getBoolean("app.dev", true));
boolean devMode = true;
if(blade.environment().hasKey("app.dev")){
devMode = blade.environment().getBoolean("app.dev", true);
}
if(blade.environment().hasKey("app.devMode")){
devMode = blade.environment().getBoolean("app.devMode", true);
}
SqliteJdbc.importSql(devMode);

ExtSql2o sql2o = new ExtSql2o(SqliteJdbc.DB_SRC);
Expand Down