const path = require('path');

function getProjectDirectory() {
    if (process.pkg) {
        return path.dirname(process.argv[0]);
    } else {
        return path.join(path.dirname(process.argv[1]), '..');
    }
}

module.exports = {
    port: (+process.env.RPNOW_PORT) || 13000,
    trustProxy: (process.env.RPNOW_TRUST_PROXY || '').toLowerCase() === 'true',
    dataDir: (process.env.RPNOW_DATA_DIR) || path.join(getProjectDirectory(), './data'),
};

const path = require('path');
const os = require('os');

function getDataDirectory() {
    const userData = process.env.APPDATA || os.homedir()
    
    return path.join(userData, 'rpnow_data');
}

module.exports = {
    port: (+process.env.RPNOW_PORT) || 13000,
    trustProxy: (process.env.RPNOW_TRUST_PROXY || '').toLowerCase() === 'true',
    dataDir: (process.env.RPNOW_DATA_DIR) || getDataDirectory(),
};

Store rpnow data in home directory instead of application directory
Store rpnow data in home directory instead of application directory
