@@ -184,6 +184,10 @@ function findInterfaces() {
184184 config . daemons [ iface ] = {
185185 type : iface ,
186186 ip : config . ccuAddress ,
187+ isSecure : config . useTLS ,
188+ useAuth : config . useAuth ,
189+ user : config . user ,
190+ pass : config . pass ,
187191 port : ports [ iface ] ,
188192 protocol : iface === 'CUxD' ? 'binrpc' : 'xmlrpc' ,
189193 reinitTimeout : iface === 'HmIP' ? 600000 : 60000 ,
@@ -194,7 +198,11 @@ function findInterfaces() {
194198 initRpcClients ( ) ;
195199 if ( regaPresent ) {
196200 rega = new Rega ( {
197- host : config . ccuAddress
201+ host : config . ccuAddress ,
202+ tls : config . useTls ,
203+ auth : config . useAuth ,
204+ user : config . user ,
205+ pass : config . pass
198206 } ) ;
199207 getRegaNames ( ) ;
200208 }
@@ -311,11 +319,25 @@ function initRpcClients() {
311319 config . daemons [ daemon ] . ident = daemon === 'CUxD' ? 'CUxD' : 'hmm_' + daemon ;
312320 daemonIndex [ config . daemons [ daemon ] . ident ] = daemon ;
313321
314- rpcClients [ daemon ] = ( config . daemons [ daemon ] . protocol === 'binrpc' ? binrpc : xmlrpc ) . createClient ( {
322+ const clientOptions = {
315323 host : config . daemons [ daemon ] . ip ,
316324 port : config . daemons [ daemon ] . port ,
317325 path : config . daemons [ daemon ] . path ,
318- } ) ;
326+ isSecure : config . daemons [ daemon ] . isSecure ,
327+ } ;
328+
329+ if ( config . daemons [ daemon ] . isSecure && config . daemons [ daemon ] . ident !== 'CUxD' ) {
330+ config . daemons [ daemon ] . port = 40000 + config . daemons [ daemon ] . port ;
331+ }
332+
333+ if ( config . daemons [ daemon ] . useAuth ) {
334+ clientOptions . basic_auth = {
335+ user : config . daemons [ daemon ] . user ,
336+ pass : config . daemons [ daemon ] . pass
337+ }
338+ }
339+
340+ rpcClients [ daemon ] = ( config . daemons [ daemon ] . protocol === 'binrpc' ? binrpc : xmlrpc ) . createClient ( clientOptions ) ;
319341
320342 initRpcServer ( config . daemons [ daemon ] . protocol ) ;
321343 init ( daemon ) ;
0 commit comments