Files
opensourcepos/.env.example
T
e20fb2a792 feat(db): add MySQL 8.4 support (#4048)
Add MySQL 8.4 compatibility, including a utf8mb4 conversion migration,
hardened foreign key handling, and expanded CI database coverage.

Migrations:
- Add Mysql84Utf8mb4Conversion migration using
  sqlscripts/3.4.3_mysql84_utf8mb4_conversion.sql via executeScript()
- Drop ospos_people composite index before conversion, since its
  prefix length exceeds the 3072-byte key limit under utf8mb4
- Add assertNoCollationCollisions() pre-flight check to fail fast on
  unique values that collide under utf8mb4_unicode_520_ci, instead of
  hitting "Duplicate entry" partway through ALTER TABLE
- Wrap the conversion in try/catch so foreign keys are recreated on
  failure; log restore errors separately so they don't mask the
  original exception
- Throw RuntimeException if re-adding the people index fails
- Remove the re-add of the sales_items_taxes FK in down(), which
  MySQL 8.4 rejects without a unique key
- Revert edits to historical migrations; fix FK handling and table
  names

migration_helper:
- Add shared dropAllForeignKeyConstraints() and
  recreateForeignKeyConstraints(); table/column now optional, dropping
  all FKs in the schema when omitted
- Match CONSTRAINT_SCHEMA when joining KEY_COLUMN_USAGE to
  REFERENTIAL_CONSTRAINTS to avoid cross-schema name collisions
- Rebuild FK lookup with the query builder and bound values instead
  of interpolated SQL

CI/tests:
- Add mysql:5.7, mariadb:10.6 and mariadb:10.11 to PHPUnit matrix
- Use master instead of latest image tag; improve CI robustness
- Mock table() in FailedQueryConnectionTrait so query builder chains
  work against the failing connection

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
Co-authored-by: aliworksx08 <57456290+aliworksx08@users.noreply.github.com>
Co-authored-by: jekkos <jeroen.peelaerts@gmail.com>
Co-authored-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 14:24:51 +04:00

119 lines
4.7 KiB
Bash

#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------
CI_ENVIRONMENT=production
#--------------------------------------------------------------------
# SECURITY: ALLOWED HOSTNAMES
#--------------------------------------------------------------------
# CRITICAL: Whitelist of allowed hostnames to prevent Host Header
# Injection attacks (GHSA-jchf-7hr6-h4f3).
#
# REQUIRED IN PRODUCTION: Application will fail to start if not configured.
# In development, falls back to 'localhost' with an error log.
#
# Configure with comma-separated list of domains/subdomains:
# app.allowedHostnames='yourdomain.com,www.yourdomain.com'
#
# Or via environment variable (useful for Docker/Compose):
# ALLOWED_HOSTNAMES=yourdomain.com,www.yourdomain.com
#
# For local development:
# app.allowedHostnames='localhost'
#
# Note: Do not include protocol (http/https) or port numbers.
app.allowedHostnames=''
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
# MySQL 5.7, 8.0, 8.4 (LTS) and MariaDB 10.x supported. MySQL 8.4 requires mysqlnd (default in PHP 8.1+).
database.default.hostname='localhost'
database.default.database='ospos'
database.default.username='admin'
database.default.password='pointofsale'
database.default.DBDriver='MySQLi'
database.default.DBPrefix='ospos_'
database.development.hostname='localhost'
database.development.database='ospos'
database.development.username='admin'
database.development.password='pointofsale'
database.development.DBDriver='MySQLi'
database.development.DBPrefix='ospos_'
database.tests.hostname='localhost'
database.tests.database='ospos_test'
database.tests.username='admin'
database.tests.password='pointofsale'
database.tests.DBDriver='MySQLi'
database.tests.DBPrefix='ospos_'
#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------
# Leave blank and the application auto-generates a unique key on first use.
# For Docker/Compose, pass it via the ENCRYPTION_KEY env var instead:
# docker run -e ENCRYPTION_KEY="$(openssl rand -hex 32)" opensourcepos
# ENCRYPTION_KEY is read as a fallback when encryption.key is empty, so no
# shared key needs to be committed or baked into the shipped image.
encryption.key=''
# Persistent secret for HMAC-hashing login-throttle cache keys. Left blank and
# provisioned on startup (php spark env:provision); independent of encryption.key.
# For Docker/Compose, pass it via the THROTTLE_KEY env var instead:
# docker run -e THROTTLE_KEY="$(openssl rand -hex 32)" opensourcepos
# THROTTLE_KEY is read as a fallback when throttle.key is empty, so no
# shared secret needs to be committed or baked into the shipped image.
throttle.key=''
#--------------------------------------------------------------------
# LOGGER
# - 0=Disables logging, Error logging TURNED OFF
# - 1=Emergency Messages - System is unusable
# - 2=Alert Messages - Action Must Be Taken Immediately
# - 3=Critical Messages - Application component unavailable, unexpected exception.
# - 4=Runtime Errors - Don't need immediate action, but should be monitored.
# - 5=Warnings - Exceptional occurrences that are not errors.
# - 6=Notices - Normal but significant events.
# - 7=Info - Interesting events, like user logging in, etc.
# - 8=Debug - Detailed debug information.
# - 9=All Messages
#--------------------------------------------------------------------
logger.threshold=0
app.db_log_enabled=false
#--------------------------------------------------------------------
# HONEYPOT
#--------------------------------------------------------------------
honeypot.hidden=true
honeypot.label='Fill This Field'
honeypot.name='honeypot'
honeypot.template='<label>{label}</label><input type="text" name="{name}" value="">'
honeypot.container='<div style="display:none">{template}</div>'
#--------------------------------------------------------------------
# SECURITY: DISALLOW PASSWORD CHANGE
#--------------------------------------------------------------------
# When true, disables the "change password" feature for all employees.
# Useful when passwords are managed by an external system (e.g. SSO/LDAP).
#
# DISALLOW_PASSWORD_CHANGE=false
DISALLOW_PASSWORD_CHANGE=false
#--------------------------------------------------------------------
# SECURITY: DISALLOW GRANT CHANGE
#--------------------------------------------------------------------
# When true, disables changing an employee's grants for all employees.
# New employees cannot be created with grants while this is enabled.
# Useful for demo deployments.
#
# DISALLOW_GRANT_CHANGE=false
DISALLOW_GRANT_CHANGE=false