@pgplex/pgconsole 1.1.1 → 1.1.3

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.
@@ -1 +1 @@
1
- import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./index-D5xgnxTK.js";export{o as ensureModuleLoaded};
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./index-Bux__b7o.js";export{o as ensureModuleLoaded};
@@ -9,8 +9,8 @@
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
10
  <link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap" rel="stylesheet" />
11
11
  <title>pgconsole</title>
12
- <script type="module" crossorigin src="/assets/index-D5xgnxTK.js"></script>
13
- <link rel="stylesheet" crossorigin href="/assets/index-C8bwjbrl.css">
12
+ <script type="module" crossorigin src="/assets/index-Bux__b7o.js"></script>
13
+ <link rel="stylesheet" crossorigin href="/assets/index-B1uc7R-v.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
package/dist/server.mjs CHANGED
@@ -40990,7 +40990,7 @@ function parse2(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
40990
40990
  }
40991
40991
 
40992
40992
  // server/lib/config.ts
40993
- import { readFileSync, existsSync } from "fs";
40993
+ import { readFileSync } from "fs";
40994
40994
 
40995
40995
  // server/lib/license.ts
40996
40996
  var LICENSE_ISSUER = "pgconsole/license";
@@ -41055,12 +41055,17 @@ function isValidHexColor(color) {
41055
41055
  return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color);
41056
41056
  }
41057
41057
  async function loadConfig(configPath) {
41058
- demoMode = false;
41059
- if (!existsSync(configPath)) {
41058
+ let content;
41059
+ try {
41060
+ content = readFileSync(configPath, "utf-8");
41061
+ } catch {
41060
41062
  throw new Error(`Config file not found: ${configPath}
41061
41063
  See https://docs.pgconsole.com/configuration/config`);
41062
41064
  }
41063
- const content = readFileSync(configPath, "utf-8");
41065
+ return loadConfigFromString(content);
41066
+ }
41067
+ async function loadConfigFromString(content) {
41068
+ demoMode = false;
41064
41069
  const parsed = parse2(content);
41065
41070
  let external_url = void 0;
41066
41071
  let license = void 0;
@@ -87664,19 +87669,24 @@ app.use((req, res, next) => {
87664
87669
  async function start() {
87665
87670
  const args = parseArgs();
87666
87671
  const port = args.port || process.env.PORT || 9876;
87667
- if (!args.config) {
87668
- console.log("No --config specified \u2014 starting in demo mode...");
87669
- const demoPort = await startDemoDatabase();
87670
- loadDemoConfig(demoPort);
87671
- console.log(`\u2713 Demo database started on port ${demoPort}`);
87672
- } else {
87672
+ if (args.config || process.env.PGCONSOLE_CONFIG) {
87673
87673
  try {
87674
- await loadConfig(args.config);
87675
- console.log(`\u2713 Loaded config from: ${path4.resolve(args.config)}`);
87674
+ if (args.config) {
87675
+ await loadConfig(args.config);
87676
+ console.log(`\u2713 Loaded config from: ${path4.resolve(args.config)}`);
87677
+ } else {
87678
+ await loadConfigFromString(process.env.PGCONSOLE_CONFIG);
87679
+ console.log("\u2713 Loaded config from PGCONSOLE_CONFIG environment variable");
87680
+ }
87676
87681
  } catch (error) {
87677
87682
  console.error("Failed to load config:", error instanceof Error ? error.message : error);
87678
87683
  process.exit(1);
87679
87684
  }
87685
+ } else {
87686
+ console.log("No --config specified \u2014 starting in demo mode...");
87687
+ const demoPort = await startDemoDatabase();
87688
+ loadDemoConfig(demoPort);
87689
+ console.log(`\u2713 Demo database started on port ${demoPort}`);
87680
87690
  }
87681
87691
  const licenseExpiry = getLicenseExpiry();
87682
87692
  if (licenseExpiry) {
@@ -87703,7 +87713,7 @@ async function start() {
87703
87713
  \\ \\_\\ /\\____/
87704
87714
  \\/_/ \\_/__/
87705
87715
 
87706
- Version ${"1.1.1"}
87716
+ Version ${"1.1.3"}
87707
87717
  `);
87708
87718
  console.log(`Server running on http://localhost:${port}`);
87709
87719
  const browserUrl = false ? `http://localhost:5173` : getExternalUrl() || `http://localhost:${port}`;