Skip to content

Commit 99bf9bc

Browse files
authored
🔀 Merge pull request #1326 from rokiden/master
Added BACKUP_DIR env for conf.yml backups
2 parents 9cff2ca + 00bc03f commit 99bf9bc

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@
3535

3636
# Again, set automatically using package.json during build time
3737
# VUE_APP_VERSION=2.0.0
38+
39+
# Directory for conf.yml backups
40+
# BACKUP_DIR=./public/

docs/developing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ You can set variables either in your environment, or using the [`.env`](https://
8080
- `INTEGRITY` - Should enable SRI for build script and link resources
8181
- `IS_DOCKER` - Computed automatically on build. Indicates if running in container
8282
- `VUE_APP_VERSION` - Again, set automatically using package.json during build time
83+
- `BACKUP_DIR` - Directory for conf.yml backups
8384

8485
### Environment Modes
8586

services/save-config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Finally, it will call a function with the status message
66
*/
77
const fsPromises = require('fs').promises;
8+
const path = require('path');
89

910
module.exports = async (newConfig, render) => {
1011
/* Either returns nothing (if using default path), or strips navigational characters from path */
@@ -24,7 +25,8 @@ module.exports = async (newConfig, render) => {
2425
};
2526

2627
// Make the full file name and path to save the backup config file
27-
const backupFilePath = `${settings.defaultLocation}${usersFileName || settings.filename}-`
28+
const backupFilePath = path.normalize(process.env.BACKUP_DIR || settings.defaultLocation)
29+
+ `/${usersFileName || settings.filename}-`
2830
+ `${Math.round(new Date() / 1000)}${settings.backupDenominator}`;
2931

3032
// The path where the main conf.yml should be read and saved to

0 commit comments

Comments
 (0)