create-headless-lms 0.1.1 → 0.2.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 +1 -1
- package/templates/env.tmpl +4 -0
- package/templates/src/config.ts +14 -1
- package/templates/src/main.ts +10 -1
package/package.json
CHANGED
package/templates/env.tmpl
CHANGED
package/templates/src/config.ts
CHANGED
|
@@ -23,6 +23,18 @@ export function loadStorageConfig(): MinioStorageConfig | undefined {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export function parseMemberImageMaxBytes(): number {
|
|
27
|
+
const raw = process.env.MEMBER_IMAGE_MAX_BYTES;
|
|
28
|
+
if (raw === undefined || raw === "") {
|
|
29
|
+
return 10 * 1024 * 1024;
|
|
30
|
+
}
|
|
31
|
+
const value = Number(raw);
|
|
32
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
33
|
+
throw new Error(`invalid MEMBER_IMAGE_MAX_BYTES "${raw}" (expected a positive integer)`);
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
/** Browser app origins from CLIENT_ORIGIN (comma-separated). */
|
|
27
39
|
export function parseClientOrigins(): string[] {
|
|
28
40
|
return (process.env.CLIENT_ORIGIN ?? "http://localhost:8001,http://localhost:8002")
|
|
@@ -59,7 +71,8 @@ export function loadServerConfig(): ServerConfig {
|
|
|
59
71
|
clientOrigins: parseClientOrigins(),
|
|
60
72
|
// Separate from STORAGE_DOWNLOAD_EXPIRY: raising the general storage
|
|
61
73
|
// default must never silently extend entitled/paywalled link lifetimes.
|
|
62
|
-
deliveryExpirySeconds: Number(process.env.DELIVERY_URL_EXPIRY ??
|
|
74
|
+
deliveryExpirySeconds: Number(process.env.DELIVERY_URL_EXPIRY ?? 86400),
|
|
75
|
+
memberImageMaxBytes: parseMemberImageMaxBytes(),
|
|
63
76
|
container,
|
|
64
77
|
};
|
|
65
78
|
}
|
package/templates/src/main.ts
CHANGED
|
@@ -16,7 +16,16 @@ const container = await createContainer(config, {
|
|
|
16
16
|
});
|
|
17
17
|
const app = await buildServer(config, container);
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
try {
|
|
20
|
+
await app.listen({ port: config.port, host: config.host });
|
|
21
|
+
} catch (err) {
|
|
20
22
|
app.log.error(err);
|
|
21
23
|
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
container.outboxRelay.start();
|
|
27
|
+
container.automationEngine.start().catch((err) => {
|
|
28
|
+
container.logger.error("automation engine failed to start", {
|
|
29
|
+
err: err instanceof Error ? err : new Error(String(err)),
|
|
30
|
+
});
|
|
22
31
|
});
|