create-kelpie 0.4.1 → 0.5.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/dist/index.js +0 -0
- package/package.json +1 -1
- package/templates/README.md +1 -0
- package/templates/env +5 -0
- package/templates/src/server.ts +11 -4
package/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/templates/README.md
CHANGED
|
@@ -64,6 +64,7 @@ lists every problem at once.
|
|
|
64
64
|
| `API_PORT` | The same number again, for the dev server's proxy |
|
|
65
65
|
| `WEB_PORT` | The Vite dev server's port. Development only |
|
|
66
66
|
| `DATABASE_URL` | A `postgres://` or `postgresql://` connection string |
|
|
67
|
+
| `APP_BASE_URL` | The address people reach this Kelpie on. Emailed links (verification, password reset, invitations) are built from it. In development that is the Vite dev server; a deployment sets its real origin |
|
|
67
68
|
| `LOG_LEVEL` | `debug`, `info`, `warn`, or `error` |
|
|
68
69
|
| `EMAIL_PROVIDER` | `log` or `smtp`. `log` writes invitations and resets to the log instead of sending them |
|
|
69
70
|
| `EMAIL_FROM` | The address transactional mail comes from |
|
package/templates/env
CHANGED
|
@@ -16,6 +16,11 @@ WEB_PORT=__WEB_PORT__
|
|
|
16
16
|
|
|
17
17
|
DATABASE_URL=__DATABASE_URL__
|
|
18
18
|
|
|
19
|
+
# The address people reach this Kelpie on, used to build the links in emails
|
|
20
|
+
# (verification, password reset, invitations). In development that is the Vite
|
|
21
|
+
# dev server below; a deployment sets its real origin.
|
|
22
|
+
APP_BASE_URL=http://localhost:__WEB_PORT__
|
|
23
|
+
|
|
19
24
|
# Seals secrets the service reads back, such as webhook signing secrets. This
|
|
20
25
|
# one was generated for this project. Losing it makes those secrets unreadable;
|
|
21
26
|
# changing it needs the rotation procedure in README.md.
|
package/templates/src/server.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
readModuleConfigFile,
|
|
17
17
|
registerModules,
|
|
18
18
|
resolveActorFrom,
|
|
19
|
+
resolveClientIpFrom,
|
|
19
20
|
runMigrations,
|
|
20
21
|
serveWebBundle,
|
|
21
22
|
} from '@kelpie/server'
|
|
@@ -76,10 +77,16 @@ async function start(): Promise<void> {
|
|
|
76
77
|
credentials,
|
|
77
78
|
createId,
|
|
78
79
|
rateLimit: config.rateLimit,
|
|
79
|
-
// The
|
|
80
|
-
//
|
|
81
|
-
// inside `createApp
|
|
82
|
-
|
|
80
|
+
// The socket address, then `X-Forwarded-For` only as far as the configured
|
|
81
|
+
// number of trusted proxies allows. Resolved from the connection itself
|
|
82
|
+
// rather than defaulted inside `createApp`, and trusting the header any
|
|
83
|
+
// further than `TRUSTED_PROXY_HOP_COUNT` would be spoofable.
|
|
84
|
+
resolveClientIp: (context) =>
|
|
85
|
+
resolveClientIpFrom(
|
|
86
|
+
getConnInfo(context).remote.address ?? 'unknown',
|
|
87
|
+
context.req.header('X-Forwarded-For'),
|
|
88
|
+
config.trustedProxyHopCount,
|
|
89
|
+
),
|
|
83
90
|
})
|
|
84
91
|
|
|
85
92
|
// After `createApp`, so every API route is registered ahead of the fallback.
|