mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Move config file to .safe-chain path.
This commit is contained in:
parent
ffbdedc7cd
commit
cfaa8e45ad
5 changed files with 115 additions and 48 deletions
|
|
@ -252,7 +252,30 @@ function getDatabaseVersionPath() {
|
|||
* @returns {string}
|
||||
*/
|
||||
function getConfigFilePath() {
|
||||
return path.join(getAikidoDirectory(), "config.json");
|
||||
const primaryPath = path.join(getSafeChainDirectory(), "config.json");
|
||||
if (fs.existsSync(primaryPath)) {
|
||||
return primaryPath;
|
||||
}
|
||||
|
||||
const legacyPath = path.join(getAikidoDirectory(), "config.json");
|
||||
if (fs.existsSync(legacyPath)) {
|
||||
return legacyPath;
|
||||
}
|
||||
|
||||
return primaryPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
function getSafeChainDirectory() {
|
||||
const homeDir = os.homedir();
|
||||
const safeChainDir = path.join(homeDir, ".safe-chain");
|
||||
|
||||
if (!fs.existsSync(safeChainDir)) {
|
||||
fs.mkdirSync(safeChainDir, { recursive: true });
|
||||
}
|
||||
return safeChainDir;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue