mirror of
https://github.com/Lissy93/dashy.git
synced 2024-09-11 14:17:02 +03:00
📡 Make user-data directory configurable
This commit is contained in:
parent
a32e76935e
commit
b66ce53669
@ -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 config
|
||||
config = 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' }))
|
||||
|
@ -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);
|
||||
|
@ -18,7 +18,7 @@ module.exports = async (newConfig, render) => {
|
||||
|
||||
// Define constants for the config file
|
||||
const settings = {
|
||||
defaultLocation: './user-data/',
|
||||
defaultLocation: process.env.USER_DATA_DIR || './user-data/',
|
||||
defaultFile: 'conf.yml',
|
||||
filename: 'conf',
|
||||
backupDenominator: '.backup.yml',
|
||||
|
Loading…
Reference in New Issue
Block a user