hoffmation-base 3.2.1-alpha.12 → 3.2.1-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -48,7 +48,7 @@ class HoffmationInitializationObject {
48
48
  exports.HoffmationInitializationObject = HoffmationInitializationObject;
49
49
  class HoffmationBase {
50
50
  static async initializeBeforeIoBroker(initObject) {
51
- var _a, _b;
51
+ var _a;
52
52
  settings_service_1.SettingsService.initialize(initObject.config);
53
53
  i18n_1.Res.initialize(initObject.config.translationSettings);
54
54
  if (initObject.config.logSettings) {
@@ -57,9 +57,12 @@ class HoffmationBase {
57
57
  logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Hoffmation-Base Startup');
58
58
  if (initObject.config.persistence) {
59
59
  if (initObject.config.persistence.postgreSql) {
60
- services_1.Persistence.dbo = new services_1.PostgreSqlPersist(initObject.config.persistence.postgreSql);
60
+ logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Creating PostgresSQL Client');
61
+ const dbo = new services_1.PostgreSqlPersist(initObject.config.persistence.postgreSql);
62
+ await dbo.initialize();
63
+ services_1.Persistence.dbo = dbo;
64
+ logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Persistence initialized');
61
65
  }
62
- await ((_a = services_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.initialize());
63
66
  }
64
67
  if (settings_service_1.SettingsService.settings.mp3Server) {
65
68
  logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Mp3Server settings detected --> initializing');
@@ -81,7 +84,7 @@ class HoffmationBase {
81
84
  logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Asus Router settings detected --> initializing');
82
85
  new services_1.AsusRouter(settings_service_1.SettingsService.settings.asusConfig);
83
86
  }
84
- else if ((_b = settings_service_1.SettingsService.settings.unifiSettings) === null || _b === void 0 ? void 0 : _b.loginOptions) {
87
+ else if ((_a = settings_service_1.SettingsService.settings.unifiSettings) === null || _a === void 0 ? void 0 : _a.loginOptions) {
85
88
  logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Unifi Router settings detected --> initializing');
86
89
  new services_1.UnifiRouter(settings_service_1.SettingsService.settings.unifiSettings.loginOptions);
87
90
  }
@@ -13,7 +13,7 @@ class Persistence {
13
13
  if (this._dbo === undefined) {
14
14
  return undefined;
15
15
  }
16
- if (this._dbo.initialized === false) {
16
+ if (!this._dbo.initialized) {
17
17
  const err = new Error('Db is not yet initialized');
18
18
  logging_1.ServerLogService.writeLog(enums_1.LogLevel.Warn, 'Db is not yet initialized, Stack: ' + err.stack);
19
19
  return undefined;