Update setup to create the config files
This commit is contained in:
@@ -104,13 +104,29 @@ const exportCsv = (nodeData) => {
|
|||||||
|
|
||||||
// Write to .env file
|
// Write to .env file
|
||||||
return new Promise(res => {
|
return new Promise(res => {
|
||||||
fs.writeFile('.env', envContent, (err) => {
|
fs.access('.env', fs.constants.F_OK, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Error writing to .env file:', err);
|
// File doesn't exist, create it
|
||||||
res(false);
|
fs.writeFile('.env', envContent, (writeErr) => {
|
||||||
|
if (writeErr) {
|
||||||
|
console.error('Error writing to .env file:', writeErr);
|
||||||
|
res(false);
|
||||||
|
} else {
|
||||||
|
console.log('.env file created successfully');
|
||||||
|
res(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('.env file updated successfully');
|
// File exists, update it
|
||||||
res(true);
|
fs.writeFile('.env', envContent, (writeErr) => {
|
||||||
|
if (writeErr) {
|
||||||
|
console.error('Error writing to .env file:', writeErr);
|
||||||
|
res(false);
|
||||||
|
} else {
|
||||||
|
console.log('.env file updated successfully');
|
||||||
|
res(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -130,13 +146,29 @@ const exportSystems = (systemsData) => {
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
return new Promise(res => {
|
return new Promise(res => {
|
||||||
fs.writeFile(radioPresetsPath, JSON.stringify(radioPresetsData, null, 4), (err) => {
|
fs.access(radioPresetsPath, fs.constants.F_OK, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Error writing to radioPresets.json:', err);
|
// File doesn't exist, create it
|
||||||
res(false);
|
fs.writeFile(radioPresetsPath, JSON.stringify(radioPresetsData, null, 4), (writeErr) => {
|
||||||
|
if (writeErr) {
|
||||||
|
console.error('Error writing to radioPresets.json:', writeErr);
|
||||||
|
res(false);
|
||||||
|
} else {
|
||||||
|
console.log('radioPresets.json created successfully');
|
||||||
|
res(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('radioPresets.json updated successfully');
|
// File exists, update it
|
||||||
res(true);
|
fs.writeFile(radioPresetsPath, JSON.stringify(radioPresetsData, null, 4), (writeErr) => {
|
||||||
|
if (writeErr) {
|
||||||
|
console.error('Error writing to radioPresets.json:', writeErr);
|
||||||
|
res(false);
|
||||||
|
} else {
|
||||||
|
console.log('radioPresets.json updated successfully');
|
||||||
|
res(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user