create-amoxi-app 0.6.1 → 0.7.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/index.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* No dependencies; works on Windows, macOS and Linux.
|
|
13
13
|
*/
|
|
14
|
+
const crypto = require('node:crypto');
|
|
14
15
|
const fs = require('node:fs');
|
|
15
16
|
const path = require('node:path');
|
|
16
17
|
const { spawnSync } = require('node:child_process');
|
|
@@ -271,6 +272,15 @@ async function main() {
|
|
|
271
272
|
engines: { node: '>=22' },
|
|
272
273
|
};
|
|
273
274
|
fs.writeFileSync(path.join(target, 'package.json'), `${JSON.stringify(pkg, null, 2)}\n`);
|
|
275
|
+
// Production requires a session secret. This one lets `npm start` run on this machine; the file is
|
|
276
|
+
// git-ignored and kept out of Docker images, so each server sets its own AMOXI_SESSION_SECRET.
|
|
277
|
+
fs.writeFileSync(
|
|
278
|
+
path.join(target, '.env.production.local'),
|
|
279
|
+
`# Generated by create-amoxi-app for running \`npm start\` on this machine. Git and Docker ignore this file:\n` +
|
|
280
|
+
`# set AMOXI_SESSION_SECRET on each server (the same value on every instance).\n` +
|
|
281
|
+
`AMOXI_SESSION_SECRET=${crypto.randomBytes(32).toString('hex')}\n`,
|
|
282
|
+
{ mode: 0o600 },
|
|
283
|
+
);
|
|
274
284
|
// Every file is written: from here on the project stays, even if installing fails.
|
|
275
285
|
unfinished = undefined;
|
|
276
286
|
|
package/package.json
CHANGED
|
@@ -13,7 +13,9 @@ Created with `create-amoxi-app`.
|
|
|
13
13
|
|
|
14
14
|
## Configuration
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Settings come from `application.json`, then `application-<profile>.json`, then `.env` files, then environment variables. The profile is `production` under `npm start` and `development` under `npm run dev`.
|
|
17
|
+
|
|
18
|
+
Production needs one secret, `AMOXI_SESSION_SECRET`, which encrypts session cookies: 32 or more random characters, the same on every instance, never committed. `create-amoxi-app` put one in `.env.production.local` so `npm start` works on this machine; that file is git-ignored and kept out of Docker images, so set the variable on each server (for Docker: `docker run -e AMOXI_SESSION_SECRET=...`).
|
|
17
19
|
|
|
18
20
|
## Deploy
|
|
19
21
|
|
|
@@ -13,7 +13,9 @@ Created with `create-amoxi-app`.
|
|
|
13
13
|
|
|
14
14
|
## Configuration
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Settings come from `application.json`, then `application-<profile>.json`, then `.env` files, then environment variables. The profile is `production` under `npm start` and `development` under `npm run dev`.
|
|
17
|
+
|
|
18
|
+
Production needs one secret, `AMOXI_SESSION_SECRET`, which encrypts session cookies: 32 or more random characters, the same on every instance, never committed. `create-amoxi-app` put one in `.env.production.local` so `npm start` works on this machine; that file is git-ignored and kept out of Docker images, so set the variable on each server (for Docker: `docker run -e AMOXI_SESSION_SECRET=...`).
|
|
17
19
|
|
|
18
20
|
## Deploy
|
|
19
21
|
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Settings from the environment. Development needs none. Production needs AMOXI_SESSION_SECRET.
|
|
2
2
|
# Copy to .env.local for local overrides (git-ignored), or set them in your hosting environment.
|
|
3
3
|
# Any configuration key works; dots become underscores, e.g. server.port:
|
|
4
4
|
# SERVER_PORT=8080
|
|
5
|
+
|
|
6
|
+
# Required in production: encrypts session cookies. 32+ random characters, the same on every instance,
|
|
7
|
+
# never committed. Generate one with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
|
|
8
|
+
# (create-amoxi-app put one in .env.production.local so `npm start` works on this machine.)
|
|
9
|
+
# AMOXI_SESSION_SECRET=
|
|
10
|
+
# Behind a load balancer or proxy that terminates TLS, so client IPs and HTTPS are seen correctly:
|
|
11
|
+
# SERVER_TRUSTPROXY=true
|