@@ -18,6 +18,7 @@ export class Config {
1818 public static tls_passphrase : string = Config . getEnv ( "tls_passphrase" , "" ) ;
1919 public static port : number = parseInt ( Config . getEnv ( "port" , "1880" ) ) ;
2020 public static domain : string = Config . getEnv ( "domain" , "localhost" ) ;
21+ public static protocol : string = Config . getEnv ( "protocol" , "http" ) ;
2122 public static nodered_domain_schema : string = Config . getEnv ( "nodered_domain_schema" , "" ) ;
2223
2324 public static api_ws_url : string = Config . getEnv ( "api_ws_url" , "ws://localhost:3000" ) ;
@@ -34,10 +35,20 @@ export class Config {
3435 if ( Config . nodered_domain_schema != "" ) {
3536 Config . domain = Config . nodered_domain_schema . replace ( "$nodered_id$" , Config . nodered_id )
3637 }
38+ // if (Config.tls_crt != '' && Config.tls_key != '') {
39+ // return "https://" + Config.domain + ":" + Config.port + "/";
40+ // }
41+ // return "http://" + Config.domain + ":" + Config.port + "/";
42+ var result : string = "" ;
3743 if ( Config . tls_crt != '' && Config . tls_key != '' ) {
38- return "https://" + Config . domain + ":" + Config . port + "/" ;
44+ result = "https://" + Config . domain ;
45+ } else {
46+ result = Config . protocol + "://" + Config . domain ;
47+ }
48+ if ( Config . port != 80 && Config . port != 443 ) {
49+ result = result + ":" + Config . port + "/" ;
3950 }
40- return "http://" + Config . domain + ":" + Config . port + "/" ;
51+ return result ;
4152 }
4253
4354 public static getEnv ( name : string , defaultvalue : string ) : string {
0 commit comments