@@ -184,6 +184,10 @@ function findInterfaces() {
184
184
config . daemons [ iface ] = {
185
185
type : iface ,
186
186
ip : config . ccuAddress ,
187
+ isSecure : config . useTLS ,
188
+ useAuth : config . useAuth ,
189
+ user : config . user ,
190
+ pass : config . pass ,
187
191
port : ports [ iface ] ,
188
192
protocol : iface === 'CUxD' ? 'binrpc' : 'xmlrpc' ,
189
193
reinitTimeout : iface === 'HmIP' ? 600000 : 60000 ,
@@ -194,7 +198,11 @@ function findInterfaces() {
194
198
initRpcClients ( ) ;
195
199
if ( regaPresent ) {
196
200
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
198
206
} ) ;
199
207
getRegaNames ( ) ;
200
208
}
@@ -311,11 +319,25 @@ function initRpcClients() {
311
319
config . daemons [ daemon ] . ident = daemon === 'CUxD' ? 'CUxD' : 'hmm_' + daemon ;
312
320
daemonIndex [ config . daemons [ daemon ] . ident ] = daemon ;
313
321
314
- rpcClients [ daemon ] = ( config . daemons [ daemon ] . protocol === 'binrpc' ? binrpc : xmlrpc ) . createClient ( {
322
+ const clientOptions = {
315
323
host : config . daemons [ daemon ] . ip ,
316
324
port : config . daemons [ daemon ] . port ,
317
325
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 ) ;
319
341
320
342
initRpcServer ( config . daemons [ daemon ] . protocol ) ;
321
343
init ( daemon ) ;
0 commit comments