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
  • Loading branch information
realJackSun committed Sep 21, 2020
1 parent 4ce897e commit cfc6b3d
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 cfc6b3d

Please sign in to comment.