Skip to content

Commit

Permalink
[ISSUE#3533] change cache dir with namespace -- part 1: unify the cac…
Browse files Browse the repository at this point in the history
…he dir (#3859)
  • Loading branch information
realJackSun authored Oct 12, 2020
1 parent 5745922 commit 17be398
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.alibaba.nacos.common.utils.ConvertUtils;
import com.alibaba.nacos.common.utils.StringUtils;

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -151,9 +152,13 @@ private void initLogName(Properties properties) {
}

private void initCacheDir() {
cacheDir = System.getProperty("com.alibaba.nacos.naming.cache.dir");
if (StringUtils.isEmpty(cacheDir)) {
cacheDir = System.getProperty("user.home") + "/nacos/naming/" + namespace;
String jmSnapshotPath = System.getProperty("JM.SNAPSHOT.PATH");
if (!StringUtils.isBlank(jmSnapshotPath)) {
cacheDir = jmSnapshotPath + File.separator + "nacos" + File.separator + "naming"
+ File.separator + namespace;
} else {
cacheDir = System.getProperty("user.home") + File.separator + "nacos" + File.separator + "naming"
+ File.separator + namespace;
}
}

Expand Down

0 comments on commit 17be398

Please sign in to comment.