π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
π‘ Make user-data directory configurable
Alicia Sykesb66ce5366964
diff --git a/server.js b/server.jsindex ce15e88b..e3a9f5d5 100644--- a/server.js+++ b/server.js@@ -18,6 +18,7 @@ const history = require('connect-history-api-fallback');/* Kick of some basic checks */require('./services/update-checker'); // Checks if there are any updates available, prints message+let config = {}; // setup the configconfig = require('./services/config-validator'); // Include and kicks off the config file validation script@@ -74,9 +75,8 @@ const app = express()// Load SSL redirection middleware.use(sslServer.middleware)// Serves up static files- .use(express.static(path.join(__dirname, 'user-data'))).use(express.static(path.join(__dirname, 'dist')))- .use(express.static(path.join(__dirname, 'user-data')))+ .use(express.static(path.join(__dirname, process.env.USER_DATA_DIR || 'user-data'))).use(express.static(path.join(__dirname, 'public'), { index: 'initialization.html' }))// Load middlewares for parsing JSON, and supporting HTML5 history routing.use(express.json({ limit: '1mb' }))diff --git a/services/config-validator.js b/services/config-validator.jsindex eeb58a3b..f7786e0e 100644--- a/services/config-validator.js+++ b/services/config-validator.js@@ -101,7 +101,7 @@ const printFileReadError = (e) => {let config = {};try { // Try to open and parse the YAML file- config = yaml.load(fs.readFileSync('./user-data/conf.yml', 'utf8'));+ config = yaml.load(fs.readFileSync(`./${process.env.USER_DATA_DIR || 'user-data'}/conf.yml`, 'utf8'));validate(config);} catch (e) { // Something went very wrong...setIsValidVariable(false);diff --git a/services/save-config.js b/services/save-config.jsindex 07f62f3f..f946be54 100644--- a/services/save-config.js+++ b/services/save-config.js@@ -18,7 +18,7 @@ module.exports = async (newConfig, render) => {// Define constants for the config fileconst settings = {- defaultLocation: './user-data/',+ defaultLocation: process.env.USER_DATA_DIR || './user-data/',defaultFile: 'conf.yml',filename: 'conf',backupDenominator: '.backup.yml',