@cedarjs/web-server 5.0.7-next.186 → 5.0.7-next.239

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/dist/bin.js CHANGED
@@ -15,7 +15,12 @@ import path from "node:path";
15
15
  import ansis from "ansis";
16
16
  import Fastify from "fastify";
17
17
  import { redwoodFastifyWeb } from "@cedarjs/fastify-web";
18
- import { getConfig, getPaths } from "@cedarjs/project-config";
18
+ import {
19
+ getConfig,
20
+ getPaths,
21
+ parsePort,
22
+ readEnvVar
23
+ } from "@cedarjs/project-config";
19
24
  async function serveWeb(options = {}) {
20
25
  const start = Date.now();
21
26
  console.log(ansis.dim.italic("Starting Web Server..."));
@@ -27,18 +32,22 @@ async function serveWeb(options = {}) {
27
32
  "no built files to serve; run `yarn cedar build web` before serving the web side"
28
33
  );
29
34
  }
30
- if (process.env.REDWOOD_WEB_PORT) {
31
- options.port ??= parseInt(process.env.REDWOOD_WEB_PORT);
35
+ const webPort = readEnvVar("CEDAR_WEB_PORT", {
36
+ deprecatedAlias: "REDWOOD_WEB_PORT"
37
+ });
38
+ if (webPort) {
39
+ options.port ??= parsePort(webPort, "CEDAR_WEB_PORT");
40
+ }
41
+ if (process.env.PORT) {
42
+ options.port ??= parsePort(process.env.PORT, "PORT");
32
43
  }
33
44
  options.port ??= getConfig().web.port;
34
- options.host ??= process.env.REDWOOD_WEB_HOST;
45
+ options.host ??= readEnvVar("CEDAR_WEB_HOST", {
46
+ deprecatedAlias: "REDWOOD_WEB_HOST"
47
+ });
48
+ options.host ??= process.env.HOST;
35
49
  options.host ??= getConfig().web.host;
36
- options.host ??= process.env.NODE_ENV === "production" ? "0.0.0.0" : "::";
37
- if (process.env.NODE_ENV === "production" && options.host !== "0.0.0.0") {
38
- console.warn(
39
- `Warning: host '${options.host}' may need to be '0.0.0.0' in production for containerized deployments`
40
- );
41
- }
50
+ options.host ??= "::";
42
51
  const fastify = Fastify({
43
52
  requestTimeout: 15e3,
44
53
  logger: {
@@ -92,7 +101,7 @@ function builder(yargs2) {
92
101
  alias: "p"
93
102
  },
94
103
  host: {
95
- description: "The host to listen on. Note that you most likely want this to be '0.0.0.0' in production",
104
+ description: "The host to listen on",
96
105
  type: "string"
97
106
  },
98
107
  apiProxyTarget: {
@@ -1 +1 @@
1
- {"version":3,"file":"cliConfig.d.ts","sourceRoot":"","sources":["../src/cliConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,eAAO,MAAM,WAAW,4CAA4C,CAAA;AAEpE,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,QA0BjD;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,aAAa,iBAGnD"}
1
+ {"version":3,"file":"cliConfig.d.ts","sourceRoot":"","sources":["../src/cliConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,eAAO,MAAM,WAAW,4CAA4C,CAAA;AAEpE,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,QAwBjD;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,aAAa,iBAGnD"}
package/dist/cliConfig.js CHANGED
@@ -7,7 +7,7 @@ function builder(yargs) {
7
7
  alias: "p"
8
8
  },
9
9
  host: {
10
- description: "The host to listen on. Note that you most likely want this to be '0.0.0.0' in production",
10
+ description: "The host to listen on",
11
11
  type: "string"
12
12
  },
13
13
  apiProxyTarget: {
@@ -1 +1 @@
1
- {"version":3,"file":"webServer.d.ts","sourceRoot":"","sources":["../src/webServer.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,wBAAsB,QAAQ,CAAC,OAAO,GAAE,aAAkB,iBA8CzD"}
1
+ {"version":3,"file":"webServer.d.ts","sourceRoot":"","sources":["../src/webServer.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,wBAAsB,QAAQ,CAAC,OAAO,GAAE,aAAkB,iBA6DzD"}
package/dist/webServer.js CHANGED
@@ -3,7 +3,12 @@ import path from "node:path";
3
3
  import ansis from "ansis";
4
4
  import Fastify from "fastify";
5
5
  import { redwoodFastifyWeb } from "@cedarjs/fastify-web";
6
- import { getConfig, getPaths } from "@cedarjs/project-config";
6
+ import {
7
+ getConfig,
8
+ getPaths,
9
+ parsePort,
10
+ readEnvVar
11
+ } from "@cedarjs/project-config";
7
12
  async function serveWeb(options = {}) {
8
13
  const start = Date.now();
9
14
  console.log(ansis.dim.italic("Starting Web Server..."));
@@ -15,18 +20,22 @@ async function serveWeb(options = {}) {
15
20
  "no built files to serve; run `yarn cedar build web` before serving the web side"
16
21
  );
17
22
  }
18
- if (process.env.REDWOOD_WEB_PORT) {
19
- options.port ??= parseInt(process.env.REDWOOD_WEB_PORT);
23
+ const webPort = readEnvVar("CEDAR_WEB_PORT", {
24
+ deprecatedAlias: "REDWOOD_WEB_PORT"
25
+ });
26
+ if (webPort) {
27
+ options.port ??= parsePort(webPort, "CEDAR_WEB_PORT");
28
+ }
29
+ if (process.env.PORT) {
30
+ options.port ??= parsePort(process.env.PORT, "PORT");
20
31
  }
21
32
  options.port ??= getConfig().web.port;
22
- options.host ??= process.env.REDWOOD_WEB_HOST;
33
+ options.host ??= readEnvVar("CEDAR_WEB_HOST", {
34
+ deprecatedAlias: "REDWOOD_WEB_HOST"
35
+ });
36
+ options.host ??= process.env.HOST;
23
37
  options.host ??= getConfig().web.host;
24
- options.host ??= process.env.NODE_ENV === "production" ? "0.0.0.0" : "::";
25
- if (process.env.NODE_ENV === "production" && options.host !== "0.0.0.0") {
26
- console.warn(
27
- `Warning: host '${options.host}' may need to be '0.0.0.0' in production for containerized deployments`
28
- );
29
- }
38
+ options.host ??= "::";
30
39
  const fastify = Fastify({
31
40
  requestTimeout: 15e3,
32
41
  logger: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/web-server",
3
- "version": "5.0.7-next.186",
3
+ "version": "5.0.7-next.239",
4
4
  "description": "CedarJS's server for the Web side",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,15 +27,15 @@
27
27
  "prepublishOnly": "NODE_ENV=production yarn build"
28
28
  },
29
29
  "dependencies": {
30
- "@cedarjs/fastify-web": "5.0.7-next.186",
31
- "@cedarjs/project-config": "5.0.7-next.186",
30
+ "@cedarjs/fastify-web": "5.0.7-next.239",
31
+ "@cedarjs/project-config": "5.0.7-next.239",
32
32
  "ansis": "4.3.1",
33
33
  "dotenv-defaults": "5.0.2",
34
34
  "fastify": "5.10.0",
35
35
  "yargs": "17.7.3"
36
36
  },
37
37
  "devDependencies": {
38
- "@cedarjs/framework-tools": "5.0.7-next.186",
38
+ "@cedarjs/framework-tools": "5.0.7-next.239",
39
39
  "typescript": "5.9.3"
40
40
  },
41
41
  "engines": {