@nsshunt/stsconfig 1.25.127 → 1.25.129

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.
@@ -1437,7 +1437,7 @@ chalk.stderr.supportsColor = stderrColor;
1437
1437
  var source = chalk;
1438
1438
  const chalk$1 = /* @__PURE__ */ getDefaultExportFromCjs(source);
1439
1439
  const { accessSync, constants, readFileSync } = fs;
1440
- let envOptions = null;
1440
+ const envOptions = {};
1441
1441
  function SetupConfig(envOptions2, logger) {
1442
1442
  const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
1443
1443
  dotenv.config({ path: envfile });
@@ -1621,30 +1621,39 @@ function SetupConfig(envOptions2, logger) {
1621
1621
  function $SetupOptions(envOptions2) {
1622
1622
  SetupConfig(envOptions2);
1623
1623
  const options = envOptions2;
1624
- const hosts = options.dbhost.split(",");
1625
- envOptions2.connectionString = hosts.map((host) => {
1626
- return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
1627
- }).join(",");
1628
- envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
1629
- return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
1630
- }).join(",");
1624
+ if (options.dbhost) {
1625
+ const hosts = options.dbhost.split(",");
1626
+ envOptions2.connectionString = hosts.map((host) => {
1627
+ return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
1628
+ }).join(",");
1629
+ envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
1630
+ return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
1631
+ }).join(",");
1632
+ }
1631
1633
  }
1632
- function $ResetOptions() {
1633
- if (envOptions === null) {
1634
- envOptions = {};
1634
+ function $ResetOptionsEx() {
1635
+ for (const prop of Object.getOwnPropertyNames(envOptions)) {
1636
+ delete envOptions[prop];
1635
1637
  }
1636
- $SetupOptions(envOptions);
1637
1638
  return envOptions;
1638
1639
  }
1639
- function $Options() {
1640
- if (envOptions === null) {
1641
- envOptions = {};
1642
- $SetupOptions(envOptions);
1643
- }
1640
+ function $ResetOptions() {
1641
+ $ResetOptionsEx();
1642
+ $SetupOptions(envOptions);
1644
1643
  return envOptions;
1645
1644
  }
1645
+ const envOptionsHandler = {
1646
+ get(target, prop, receiver) {
1647
+ if (Object.keys(target).length === 0) {
1648
+ $SetupOptions(target);
1649
+ }
1650
+ return Reflect.get(target, prop, receiver);
1651
+ }
1652
+ };
1653
+ const goptions = new Proxy(envOptions, envOptionsHandler);
1646
1654
  export {
1647
- $Options,
1648
- $ResetOptions
1655
+ $ResetOptions,
1656
+ $ResetOptionsEx,
1657
+ goptions
1649
1658
  };
1650
1659
  //# sourceMappingURL=stsconfig.mjs.map