create-guren-app 1.5.0 → 1.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-guren-app",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,9 +18,9 @@
18
18
  "test": "bun test"
19
19
  },
20
20
  "dependencies": {
21
- "@guren/cli": "^2.0.0",
21
+ "@guren/cli": "^2.1.0",
22
22
  "@guren/core": "^1.5.0",
23
- "@guren/orm": "^2.0.0",
23
+ "@guren/orm": "^2.1.0",
24
24
  "drizzle-orm": "1.0.0-rc.4"
25
25
  },
26
26
  "devDependencies": {
@@ -2,13 +2,36 @@ import { createApp } from '@guren/core'
2
2
  import DatabaseProvider from '../app/Providers/DatabaseProvider.js'
3
3
  import { registerApiRoutes } from '../routes/api.js'
4
4
 
5
+ // The Host header is client-controlled, so production should answer only to the
6
+ // host this app is deployed as, which APP_URL carries.
7
+ //
8
+ // Read at module scope, where not every platform has populated process.env yet
9
+ // (the Cloudflare worker imports this module before wrangler `vars` land). A
10
+ // missing value therefore warns and leaves the check off, rather than throwing
11
+ // and stopping the app from booting at all. Emailed links do not depend on this
12
+ // — app/Auth/AppUrl.ts resolves those per request and fails closed there.
13
+ function hostAuthorization() {
14
+ const exclude = ['/health']
15
+
16
+ if (process.env.NODE_ENV !== 'production') {
17
+ return { allowedHosts: ['localhost:*', '127.0.0.1:*'], exclude }
18
+ }
19
+
20
+ const appUrl = process.env.APP_URL?.trim()
21
+ if (!appUrl) {
22
+ console.warn('[app] APP_URL is not set — host authorization is disabled. Set it to the public base URL of this app.')
23
+ return false
24
+ }
25
+
26
+ // `hostname:*` rather than the bare host: the hostname is the security
27
+ // boundary, and a proxy may or may not include the default port in `Host`.
28
+ return { allowedHosts: [`${new URL(appUrl).hostname}:*`], exclude }
29
+ }
30
+
5
31
  const app = createApp({
6
32
  routes: registerApiRoutes,
7
33
  providers: [DatabaseProvider],
8
- hostAuthorization: process.env.NODE_ENV === 'production' ? false : {
9
- allowedHosts: ['localhost:*', '127.0.0.1:*'],
10
- exclude: ['/health'],
11
- },
34
+ hostAuthorization: hostAuthorization(),
12
35
  })
13
36
 
14
37
  export default app
@@ -10,14 +10,37 @@ setInertiaDocument({
10
10
  head: '<link rel="icon" type="image/svg+xml" href="/favicon.svg" />',
11
11
  })
12
12
 
13
+ // The Host header is client-controlled, so production should answer only to the
14
+ // host this app is deployed as, which APP_URL carries.
15
+ //
16
+ // Read at module scope, where not every platform has populated process.env yet
17
+ // (the Cloudflare worker imports this module before wrangler `vars` land). A
18
+ // missing value therefore warns and leaves the check off, rather than throwing
19
+ // and stopping the app from booting at all. Emailed links do not depend on this
20
+ // — app/Auth/AppUrl.ts resolves those per request and fails closed there.
21
+ function hostAuthorization() {
22
+ const exclude = ['/healthcheck', '/up']
23
+
24
+ if (process.env.NODE_ENV !== 'production') {
25
+ return { allowedHosts: ['localhost:*', '127.0.0.1:*'], exclude }
26
+ }
27
+
28
+ const appUrl = process.env.APP_URL?.trim()
29
+ if (!appUrl) {
30
+ console.warn('[app] APP_URL is not set — host authorization is disabled. Set it to the public base URL of this app.')
31
+ return false
32
+ }
33
+
34
+ // `hostname:*` rather than the bare host: the hostname is the security
35
+ // boundary, and a proxy may or may not include the default port in `Host`.
36
+ return { allowedHosts: [`${new URL(appUrl).hostname}:*`], exclude }
37
+ }
38
+
13
39
  const app = createApp({
14
40
  auth: {},
15
41
  routes: registerWebRoutes,
16
42
  providers: [DatabaseProvider, AuthProvider, AuthorizationProvider],
17
- hostAuthorization: process.env.NODE_ENV === 'production' ? false : {
18
- allowedHosts: ['localhost:*', '127.0.0.1:*'],
19
- exclude: ['/healthcheck', '/up'],
20
- },
43
+ hostAuthorization: hostAuthorization(),
21
44
  })
22
45
 
23
46
  export default app
@@ -19,10 +19,10 @@
19
19
  "db:seed": "bunx guren db:seed"
20
20
  },
21
21
  "dependencies": {
22
- "@guren/cli": "^2.0.0",
22
+ "@guren/cli": "^2.1.0",
23
23
  "@guren/core": "^1.5.0",
24
24
  "@guren/inertia-client": "^1.0.2",
25
- "@guren/orm": "^2.0.0",
25
+ "@guren/orm": "^2.1.0",
26
26
  "@inertiajs/react": "^3.6.1",
27
27
  "drizzle-orm": "1.0.0-rc.4",
28
28
  "react": "^19.0.0",
@@ -9,13 +9,36 @@ setInertiaDocument({
9
9
  head: '<link rel="icon" type="image/svg+xml" href="/favicon.svg" />',
10
10
  })
11
11
 
12
+ // The Host header is client-controlled, so production should answer only to the
13
+ // host this app is deployed as, which APP_URL carries.
14
+ //
15
+ // Read at module scope, where not every platform has populated process.env yet
16
+ // (the Cloudflare worker imports this module before wrangler `vars` land). A
17
+ // missing value therefore warns and leaves the check off, rather than throwing
18
+ // and stopping the app from booting at all. Emailed links do not depend on this
19
+ // — app/Auth/AppUrl.ts resolves those per request and fails closed there.
20
+ function hostAuthorization() {
21
+ const exclude = ['/healthcheck', '/up']
22
+
23
+ if (process.env.NODE_ENV !== 'production') {
24
+ return { allowedHosts: ['localhost:*', '127.0.0.1:*'], exclude }
25
+ }
26
+
27
+ const appUrl = process.env.APP_URL?.trim()
28
+ if (!appUrl) {
29
+ console.warn('[app] APP_URL is not set — host authorization is disabled. Set it to the public base URL of this app.')
30
+ return false
31
+ }
32
+
33
+ // `hostname:*` rather than the bare host: the hostname is the security
34
+ // boundary, and a proxy may or may not include the default port in `Host`.
35
+ return { allowedHosts: [`${new URL(appUrl).hostname}:*`], exclude }
36
+ }
37
+
12
38
  const app = createApp({
13
39
  routes: registerWebRoutes,
14
40
  providers: [DatabaseProvider],
15
- hostAuthorization: process.env.NODE_ENV === 'production' ? false : {
16
- allowedHosts: ['localhost:*', '127.0.0.1:*'],
17
- exclude: ['/healthcheck', '/up'],
18
- },
41
+ hostAuthorization: hostAuthorization(),
19
42
  })
20
43
 
21
44
  export default app