Skip to content

Commit

Permalink
🔀 Merge pull request #1326 from rokiden/master
Browse files Browse the repository at this point in the history
Added BACKUP_DIR env for conf.yml backups
  • Loading branch information
Lissy93 authored Sep 28, 2023
2 parents 9cff2ca + 00bc03f commit 99bf9bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@

# Again, set automatically using package.json during build time
# VUE_APP_VERSION=2.0.0

# Directory for conf.yml backups
# BACKUP_DIR=./public/
1 change: 1 addition & 0 deletions docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ You can set variables either in your environment, or using the [`.env`](https://
- `INTEGRITY` - Should enable SRI for build script and link resources
- `IS_DOCKER` - Computed automatically on build. Indicates if running in container
- `VUE_APP_VERSION` - Again, set automatically using package.json during build time
- `BACKUP_DIR` - Directory for conf.yml backups

### Environment Modes

Expand Down
4 changes: 3 additions & 1 deletion services/save-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Finally, it will call a function with the status message
*/
const fsPromises = require('fs').promises;
const path = require('path');

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

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

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

1 comment on commit 99bf9bc

@vercel
Copy link

@vercel vercel bot commented on 99bf9bc Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dashy – ./

dashy-delta.vercel.app
dashy-alicia.vercel.app
dashy-git-master-alicia.vercel.app

Please sign in to comment.