|
1 | 1 | import * as https from "https"; |
2 | 2 | import * as retry from "async-retry"; |
3 | 3 | import { fetch, toPassportConfig } from "passport-saml-metadata"; |
| 4 | +import { NoderedUtil } from "./nodered/nodes/NoderedUtil"; |
4 | 5 | export class Config { |
5 | 6 | public static nodered_id: string = Config.getEnv("nodered_id", "1"); |
6 | 7 | public static nodered_sa: string = Config.getEnv("nodered_sa", ""); |
@@ -36,14 +37,20 @@ export class Config { |
36 | 37 | public static aes_secret: string = Config.getEnv("aes_secret", ""); |
37 | 38 |
|
38 | 39 | public static baseurl(): string { |
39 | | - var matches = Config.nodered_id.match(/\d+/); |
40 | | - if (matches !== null && matches !== undefined) { |
41 | | - if (matches.length > 0) { |
42 | | - Config.nodered_id = matches[matches.length - 1]; // Just grab the last number |
| 40 | + if (NoderedUtil.IsNullEmpty(Config.nodered_sa)) { |
| 41 | + var matches = Config.nodered_id.match(/\d+/); |
| 42 | + if (matches !== null && matches !== undefined) { |
| 43 | + if (matches.length > 0) { |
| 44 | + Config.nodered_id = matches[matches.length - 1]; // Just grab the last number |
| 45 | + } |
| 46 | + } |
| 47 | + if (Config.nodered_domain_schema != "") { |
| 48 | + Config.domain = Config.nodered_domain_schema.replace("$nodered_id$", Config.nodered_id) |
| 49 | + } |
| 50 | + } else { |
| 51 | + if (Config.nodered_domain_schema != "") { |
| 52 | + Config.domain = Config.nodered_domain_schema.replace("$nodered_id$", Config.nodered_id) |
43 | 53 | } |
44 | | - } |
45 | | - if (Config.nodered_domain_schema != "") { |
46 | | - Config.domain = Config.nodered_domain_schema.replace("$nodered_id$", Config.nodered_id) |
47 | 54 | } |
48 | 55 | // if (Config.tls_crt != '' && Config.tls_key != '') { |
49 | 56 | // return "https://" + Config.domain + ":" + Config.port + "/"; |
|
0 commit comments