This commit is contained in:
seb
2026-10-30 16:10:07 +01:00
parent ab6fcc107f
commit 02301ff172
7 changed files with 28 additions and 5 deletions

View File

@@ -15,7 +15,8 @@ COPY --from=syslibs /usr/lib/x86_64-linux-gnu/libfontconfig.so* /usr/lib/x86_64-
COPY --from=syslibs /usr/lib/x86_64-linux-gnu/libfribidi.so* /usr/lib/x86_64-linux-gnu/ COPY --from=syslibs /usr/lib/x86_64-linux-gnu/libfribidi.so* /usr/lib/x86_64-linux-gnu/
# Set production defaults: port 4208 # Set production defaults: port 4208
ENV NODE_ENV=production \ ENV RUNNING_IN_DOCKER=true \
NODE_ENV=production \
HOST=0.0.0.0 \ HOST=0.0.0.0 \
PORT=4208 \ PORT=4208 \
HTTPS_PORT=0 \ HTTPS_PORT=0 \

View File

@@ -235,7 +235,7 @@ _none_
- Returns: `200 { message: str }` - Returns: `200 { message: str }`
#### Current user — `GET /auth/me` #### Current user — `GET /auth/me`
_none_ _none_
- Returns: `200 { user: T32, googleClientId: str, schemaVersion: int }` - Returns: `200 { user: T32, googleClientId: str, schemaVersion: int, vhost: bool, vhostSettings: str }`
#### Set selected company — `PUT /auth/selected-company` #### Set selected company — `PUT /auth/selected-company`
- Params: `body: { companyId: int }` - Params: `body: { companyId: int }`
- Returns: `200 { user: T32 }` - Returns: `200 { user: T32 }`

View File

@@ -22,7 +22,9 @@ Authenticated
"picture": "…" "picture": "…"
}, },
"googleClientId": "…", "googleClientId": "…",
"schemaVersion": 1 "schemaVersion": 1,
"vhost": true,
"vhostSettings": "…"
} }
``` ```

View File

@@ -27,6 +27,7 @@ docker run -d \
-e GOOGLE_CLIENT_ID=928121624463-m9du45ek2d5f6p9cke8qpnf89ii9no20.apps.googleusercontent.com \ -e GOOGLE_CLIENT_ID=928121624463-m9du45ek2d5f6p9cke8qpnf89ii9no20.apps.googleusercontent.com \
-e JWT_SECRET=dfhjkswezui32476sdjkhvbn347865 \ -e JWT_SECRET=dfhjkswezui32476sdjkhvbn347865 \
-e IMPLICIT_CREATE=true \ -e IMPLICIT_CREATE=true \
-e VHOST_SETTINGS="" \
-e DB_PROVIDER=mssql \ -e DB_PROVIDER=mssql \
-e MSSQL_DATABASE=dashback \ -e MSSQL_DATABASE=dashback \
-e MSSQL_USER=sa \ -e MSSQL_USER=sa \

View File

@@ -12,5 +12,7 @@ export async function respondWithAuthenticatedUser(res, status, body) {
...body, ...body,
googleClientId: env.googleClientId, googleClientId: env.googleClientId,
schemaVersion, schemaVersion,
vhost: env.vhost,
vhostSettings: env.vhostSettings,
}); });
} }

View File

@@ -36,6 +36,12 @@ export function register(app, basePath = '') {
* schemaVersion: * schemaVersion:
* type: integer * type: integer
* description: Current database schema version * description: Current database schema version
* vhost:
* type: boolean
* description: True when running in Docker (client may change feature set)
* vhostSettings:
* type: string
* description: Pipelined settings string from VHOST_SETTINGS env
* 401: * 401:
* description: Unauthorized — still includes `googleClientId` and `schemaVersion` for the frontend * description: Unauthorized — still includes `googleClientId` and `schemaVersion` for the frontend
* content: * content:
@@ -50,6 +56,12 @@ export function register(app, basePath = '') {
* schemaVersion: * schemaVersion:
* type: integer * type: integer
* description: Current database schema version * description: Current database schema version
* vhost:
* type: boolean
* description: True when running in Docker (client may change feature set)
* vhostSettings:
* type: string
* description: Pipelined settings string from VHOST_SETTINGS env
*/ */
app.get(`${basePath}/auth/me`, async (req, res) => { app.get(`${basePath}/auth/me`, async (req, res) => {
try { try {

View File

@@ -12,7 +12,12 @@ function parseHttpsPort(val) {
return Number.isInteger(n) && n > 0 ? n : 8443; return Number.isInteger(n) && n > 0 ? n : 8443;
} }
const isDocker = process.env.RUNNING_IN_DOCKER === 'true';
export default { export default {
isDocker,
vhost: isDocker,
vhostSettings: process.env.VHOST_SETTINGS || '',
host: process.env.HOST || '127.0.0.1', host: process.env.HOST || '127.0.0.1',
port: Number(process.env.PORT) || 4208, port: Number(process.env.PORT) || 4208,
httpsPort: parseHttpsPort(process.env.HTTPS_PORT), httpsPort: parseHttpsPort(process.env.HTTPS_PORT),
@@ -50,7 +55,7 @@ export default {
storageDir: process.env.STORAGE_DIR || resolve(__dirname, '../../data/storage'), storageDir: process.env.STORAGE_DIR || resolve(__dirname, '../../data/storage'),
}, },
backup: { backup: {
enabled: process.env.BACKUP_ENABLED !== 'false', enabled: !isDocker && process.env.BACKUP_ENABLED !== 'false',
dir: process.env.BACKUP_DIR ? resolve(process.env.BACKUP_DIR) : resolve(__dirname, '../../data/backups'), dir: process.env.BACKUP_DIR ? resolve(process.env.BACKUP_DIR) : resolve(__dirname, '../../data/backups'),
intervalMs: Number(process.env.BACKUP_INTERVAL_MS) || 60 * 60 * 1000, intervalMs: Number(process.env.BACKUP_INTERVAL_MS) || 60 * 60 * 1000,
hourlyRetentionCount: Number(process.env.BACKUP_HOURLY_RETENTION) || 50, hourlyRetentionCount: Number(process.env.BACKUP_HOURLY_RETENTION) || 50,
@@ -65,7 +70,7 @@ export default {
key: process.env.REDIS_KEY || process.env.REDIS_HEALTH_KEY || 'healthcheck:latency_ms', key: process.env.REDIS_KEY || process.env.REDIS_HEALTH_KEY || 'healthcheck:latency_ms',
}, },
healthMonitor: { healthMonitor: {
enabled: process.env.HEALTH_MONITOR_ENABLED !== 'false', enabled: !isDocker && process.env.HEALTH_MONITOR_ENABLED !== 'false',
intervalMs: Number(process.env.HEALTH_MONITOR_INTERVAL_MS) || 60_000, intervalMs: Number(process.env.HEALTH_MONITOR_INTERVAL_MS) || 60_000,
}, },
}; };