Ports the corporate-GitHub wilm branch onto main, keeping the two branches
separate. Thirteen upstream commits arrive with their authorship intact; the
review fixes and the portability work below are on top.
What arrives:
endpoints plugin - a ShopDB agent reporting endpoint state, telemetry,
services and interfaces, with a command channel the agent
long-polls. Ingest stays on the generic collector route
(ADR-006); the agent key is a UI-managed single-scope
token whose revocation is an instant kill switch.
computers policies - Configuration and Business Policies (RMM-style), scope
trees validated at write time, actions checked against
the endpoints command allowlist. Feature-gated: every
route 404s while the setting is off, so enabling it can
never half-expose the surface.
asset CSV import - templates, a collector script carrying the site path, and
a validate-then-commit import. A plugin can own a virtual
column plus a post-write row hook, which is how a PC's
machine number becomes a controls link without a
hand-built relationships sheet.
agent/ - the Windows agent and its installer.
Contract 0.21.0 -> 0.24.0, additive throughout: register_import_hook (0.22),
mint/list/revoke_service_token (0.23), collector_authorized (0.24). The stability
table had no rows for any of them and now does.
MySQL 5.6 portability. The branch stored three policy columns as sa.JSON, the
only JSON columns in the product, and 5.6 has no JSON type: the migration failed
with a bare syntax error near the word JSON. They are TEXT now, through a
JSONText type decorator, so all seventeen call sites still read and write dicts.
The convention elsewhere is already TEXT (guides.blocksjson,
geenforce.manifestjson).
Review fixes carried on top:
- six policy GETs were jwt_required(optional=True), which authenticates a
caller without checking anything; they require computers.view now, and six
redundant jwt_required decorators are gone
- the agent installer took a default BaseUrl and CollectorKey, so a mistyped
run silently pointed an endpoint at the wrong instance; both are mandatory
and a non-https BaseUrl throws unless -AllowInsecureHttp is passed
- a committing CSV import wrote no audit row
Documentation: the 34 new routes are described in docs/api-inventory.json, which
is hand-maintained on purpose, and the generated spec now covers 331 paths and
477 operations across 22 surfaces. DEVELOPMENT-SETUP's 1071 troubleshooting row
said "use MySQL 8 for dev" and now gives the actual fix, including the trap that
5.6 downgrades ROW_FORMAT=DYNAMIC to Compact with a warning instead of an error.
Full suite 2123 passed, vitest 260 passed, all seventeen plugin chains migrate
clean on MySQL 5.6 and the naming, docs, parity and read-surface gates are green.
113 lines
4.6 KiB
Plaintext
113 lines
4.6 KiB
Plaintext
# shopdb-flask environment template.
|
|
#
|
|
# Copy to .env and fill in the values. .env is gitignored. ProductionConfig
|
|
# refuses to boot when SECRET_KEY, JWT_SECRET_KEY, DATABASE_URL, or
|
|
# CORS_ORIGINS are missing or use the dev defaults.
|
|
#
|
|
# See the DEPLOY wiki page for the full per-site deployment runbook.
|
|
|
|
# ---- Flask ----
|
|
FLASK_APP=wsgi.py
|
|
|
|
# Set to 'production' for live sites. Other valid values: 'development',
|
|
# 'testing'. Production triggers ProductionConfig.validate() at boot.
|
|
FLASK_ENV=production
|
|
|
|
# ---- Required secrets (production refuses to boot without these) ----
|
|
|
|
# Generate strong random values, e.g.:
|
|
# python -c "import secrets; print(secrets.token_urlsafe(64))"
|
|
SECRET_KEY=change-this-to-a-secure-random-string
|
|
JWT_SECRET_KEY=change-this-to-another-secure-random-string
|
|
|
|
# ---- Database (required) ----
|
|
|
|
# Format: mysql+pymysql://<user>:<password>@<host>:<port>/<database>?charset=utf8mb4
|
|
# In docker-compose, host is `db` (the service name).
|
|
# The ?charset=utf8mb4 keeps the connection on utf8mb4; create the database as
|
|
# utf8mb4 too (see the DEPLOY wiki page). Both must be utf8mb4 to match the schema.
|
|
DATABASE_URL=mysql+pymysql://shopdb:CHANGE_ME@db:3306/shopdb_flask?charset=utf8mb4
|
|
|
|
# ---- CORS (required, no wildcards in production) ----
|
|
|
|
# Comma-separated list of explicit origins permitted to call the API.
|
|
# Example for a single-host facility deploy:
|
|
# CORS_ORIGINS=https://shopdb.facility-a.example.com
|
|
# Wildcard '*' is rejected by ProductionConfig.validate().
|
|
CORS_ORIGINS=http://localhost:5173
|
|
|
|
# ---- JWT lifecycle (optional, defaults shown) ----
|
|
JWT_ACCESS_TOKEN_EXPIRES=3600
|
|
JWT_REFRESH_TOKEN_EXPIRES=2592000
|
|
|
|
# ---- Logging (optional) ----
|
|
LOG_LEVEL=INFO
|
|
|
|
# ---- docker-compose only ----
|
|
# These are read by docker-compose.yml; not used by the Flask app directly.
|
|
MYSQL_ROOT_PASSWORD=CHANGE_ME_ROOT_PASSWORD
|
|
MYSQL_PASSWORD=CHANGE_ME_APP_PASSWORD
|
|
MYSQL_PORT=3306
|
|
API_PORT=5001
|
|
# Air-gapped deploy only (docker-compose.airgap.yml): the loaded image tag,
|
|
# which MUST match what build-offline-bundle.ps1 -Version produced. Ignored by
|
|
# the connected build template (docker-compose.yml builds from source).
|
|
IMAGE_TAG=0.7.0
|
|
|
|
# ---- Zabbix integration (optional, for printer supply monitoring) ----
|
|
ZABBIX_URL=
|
|
ZABBIX_TOKEN=
|
|
|
|
# ---- Per-plugin collector API keys (optional) ----
|
|
# Per ADR-006, each plugin can accept external collector input at
|
|
# /api/collector/<pluginname>. The framework checks
|
|
# COLLECTOR_API_KEY_<PLUGINNAME> first, then COLLECTOR_API_KEY as fallback.
|
|
# COLLECTOR_API_KEY=
|
|
# COLLECTOR_API_KEY_COMPUTERS=
|
|
# COLLECTOR_API_KEY_ENDPOINTS=
|
|
|
|
# ---- Trusted plugin publisher keys (ADR-013, optional) ----
|
|
# Public-key PEM paths (OS path separator: ':' on Linux, ';' on Windows) used
|
|
# to verify signed plugin artifacts. Delivered with this config, NEVER from the
|
|
# plugin shelf. Empty on a site that does not adopt marketplace plugins.
|
|
# PLUGIN_TRUSTED_KEYS=/etc/shopdb/keys/curator.pub
|
|
#
|
|
# Enforce signatures: a plugin only loads/migrates if its tree matches a
|
|
# trusted signature. Default off. Turn on only after stamping plugins
|
|
# (flask plugin stamp-bundled) and pinning keys above.
|
|
# PLUGIN_REQUIRE_SIGNED=false
|
|
#
|
|
# Dev-only: directories whose UNSIGNED plugins are trusted, honored ONLY under
|
|
# DEBUG/TESTING (external-repo/symlink dev). Production ignores this.
|
|
# PLUGIN_DEV_TRUST_DIRS=/home/dev/my-plugin-repo
|
|
#
|
|
# Read-only folder the app pulls plugin artifacts from (a SharePoint-synced or
|
|
# copied shelf). The app reads this folder; it never speaks any network.
|
|
# PLUGIN_SHELF_DIR=/srv/shopdb/plugin-shelf
|
|
|
|
# ---- Employee directory database (optional, read-only) ----
|
|
# Separate HR/employee lookup DB consumed by the notifications plugin and the
|
|
# public shopfloor kiosks. Leave unset if the feature is not used; there is no
|
|
# safe default for the password, so an unset password fails loud.
|
|
# EMPLOYEE_DB_HOST=
|
|
# EMPLOYEE_DB_USER=
|
|
# EMPLOYEE_DB_PASSWORD=
|
|
# EMPLOYEE_DB_NAME=wjf_employees
|
|
|
|
# ---- cmmc_usb database (USB check-in/out) ----
|
|
# Separate read-write MySQL DB used by the USB plugin to track device
|
|
# check-in/out, lockers, and the check-in/out log. Leave unset if the feature
|
|
# is not used; there is no safe default for the password, so an unset password
|
|
# fails loud.
|
|
# CMMC_USB_DB_HOST=
|
|
# CMMC_USB_DB_USER=
|
|
# CMMC_USB_DB_PASSWORD=
|
|
# CMMC_USB_DB_NAME=cmmc_usb
|
|
|
|
# ---- Subpath deployment (optional) ----
|
|
# Serve the app under a URL prefix instead of the server root, e.g. as an IIS
|
|
# Application at /ops under an existing site. The frontend must be rebuilt with
|
|
# the matching base: VITE_BASE_PATH=/ops/ npm run build. Leave unset when the
|
|
# app owns its own site/port (the default). See the INSTALL-WINDOWS-IIS wiki page.
|
|
# MOUNT_PATH=/ops
|