@niledatabase/server 3.0.0-alpha.35 → 3.0.0-alpha.37

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.
@@ -501,6 +501,12 @@ var getUsername = function getUsername(cfg) {
501
501
  logger && info(logger + "[config] " + config.user);
502
502
  return String(config == null ? void 0 : config.user);
503
503
  }
504
+ if (process.env.NILEDB_POSTGRES_URL) {
505
+ var url = new URL(process.env.NILEDB_POSTGRES_URL);
506
+ if (url.username) {
507
+ return url.username;
508
+ }
509
+ }
504
510
  logger && info(logger + "[NILEDB_USER] " + process.env.NILEDB_USER);
505
511
  return process.env.NILEDB_USER;
506
512
  };
@@ -514,6 +520,12 @@ var getPassword = function getPassword(cfg) {
514
520
  log && info(logger + "[config] " + config.password);
515
521
  return String(config.password);
516
522
  }
523
+ if (process.env.NILEDB_POSTGRES_URL) {
524
+ var url = new URL(process.env.NILEDB_POSTGRES_URL);
525
+ if (url.password) {
526
+ return url.password;
527
+ }
528
+ }
517
529
  logger && info(logger + "[NILEDB_PASSWORD] " + process.env.NILEDB_PASSWORD);
518
530
  return process.env.NILEDB_PASSWORD;
519
531
  };
@@ -4512,7 +4524,10 @@ var Server = /*#__PURE__*/function () {
4512
4524
  // propagate special config items
4513
4525
  this.tenantId = updatedConfig.tenantId;
4514
4526
  this.userId = updatedConfig.userId;
4515
- this.token = updatedConfig.api.token;
4527
+ // if we have a token, update it, else use the one that was there
4528
+ if (updatedConfig.api.token) {
4529
+ this.token = updatedConfig.api.token;
4530
+ }
4516
4531
  this.databaseId = updatedConfig.databaseId;
4517
4532
  return this;
4518
4533
  };