Move config file to .safe-chain path.

This commit is contained in:
Sander Declerck 2026-03-19 16:10:32 +01:00
parent ffbdedc7cd
commit cfaa8e45ad
No known key found for this signature in database
5 changed files with 115 additions and 48 deletions

View file

@ -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;
}
/**