config.cli: allow to specify rtorrent.rc for managed rTorrent daemon

This commit is contained in:
Jesse Chan
2020-11-29 00:11:36 +08:00
parent 0519a39bd6
commit 5e39927161
+16 -1
View File
@@ -134,6 +134,12 @@ const {argv} = require('yargs')
hidden: true,
type: 'boolean',
})
.option('rtconfig', {
describe: 'ADVANCED: rtorrent.rc for managed rTorrent daemon',
implies: 'rtorrent',
hidden: true,
type: 'string',
})
.option('proxy', {
default: 'http://127.0.0.1:3000',
describe: 'DEV ONLY: See the "Local Development" section of README.md',
@@ -145,7 +151,16 @@ const {argv} = require('yargs')
.help();
if (argv.rtorrent) {
const rTorrentProcess = spawn('rtorrent', ['-o', 'system.daemon.set=true']);
const args = [];
let opts = 'system.daemon.set=true';
if (typeof argv.rtconfig === 'string' && argv.rtconfig.length > 0) {
args.push('-n');
opts += `,import=${argv.rtconfig}`;
}
const rTorrentProcess = spawn('rtorrent', args.concat(['-o', opts]));
process.on('exit', () => {
console.log('Killing rTorrent daemon...');
rTorrentProcess.kill('SIGTERM');