Skip to content

Configuration Reference

All configuration is loaded from environment variables. The application reads .env files from the current directory and project root on startup.

Example .env File

bash
ENVIRONMENT=development
APP_PORT=8080
AUTH_TOKEN_SECRET=replace-with-at-least-32-characters

DATABASE_HOST=mysql
DATABASE_PORT=3306
DATABASE_USERNAME=trackme
DATABASE_PASSWORD=trackme
DATABASE_NAME=tracker

ERP_INTEGRATION_ENABLED=false

Core / Application

VariableDescriptionDefaultRequired
APP_PORTHTTP server listen port8080No
ENVIRONMENTRuntime environment (development, staging, production)productionNo
DEBUGEnable debug modefalseNo
APP_LOCAL_TIMEZONEApplication timezone (IANA format, e.g. Europe/London)UTCNo

Database

The application supports MySQL (primary) and SQLite engines.

VariableDescriptionDefaultRequired
DATABASE_ENGINEDatabase driver (mysql or sqlite)mysqlNo
DATABASE_URLFull DSN (fallback if individual vars not set)trackme:trackme@/tracker?parseTime=trueNo
DATABASE_HOSTMySQL hostFor MySQL
DATABASE_PORTMySQL port3306No
DATABASE_USERNAMEMySQL userFor MySQL
DATABASE_PASSWORDMySQL passwordFor MySQL
DATABASE_NAMEMySQL database nameFor MySQL
DATABASE_PATHSQLite file pathFor SQLite

INFO

When DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, and DATABASE_NAME are all set, they take precedence over DATABASE_URL. The connection string is built as user:pass@tcp(host:port)/dbname?parseTime=true.

Authentication

VariableDescriptionDefaultRequired
AUTH_TOKEN_SECRETJWT signing secret for admin auth (HS256)Yes (min 32 chars)

WARNING

The application validates this on startup and will not start if it is missing or shorter than 32 characters.

ERP / iSAMS Integration

These variables control the optional iSAMS integration. When disabled, all ERP-related features and cron jobs are skipped.

VariableDescriptionDefaultRequired
ERP_INTEGRATION_ENABLEDMaster toggle for iSAMS integrationfalseNo
ISAMS_BASE_URLiSAMS API base URLWhen ERP enabled
ISAMS_API_CLIENT_IDOAuth2 client IDWhen ERP enabled
ISAMS_API_CLIENT_SECRETOAuth2 client secretWhen ERP enabled
ERP_LOCAL_TIMEZONETimezone for ERP date calculationsSystem localNo
ERP_MAIN_REGISTRATION_PERIOD_TYPERegistration period type codeAMNo
ERP_DEFAULT_LESSON_ABSENCE_CODE_NAMEDefault absence code nameONo
AUTO_REGISTRATION_YEAR_GROUPSComma-separated year groups for auto-absence markingNo
FORCE_ERP_SYNC_ON_STARTForce a full student sync on application startfalseNo

TIP

ERP integration is only active when all three conditions are met: ERP_INTEGRATION_ENABLED=true, ISAMS_BASE_URL is set, and both ISAMS_API_CLIENT_ID and ISAMS_API_CLIENT_SECRET are provided.

Cron Schedules

These cron expressions are only used when ERP integration is enabled. Format follows standard cron syntax.

VariableDescriptionDefault
CRON_STUDENT_SYNCStudent data sync from iSAMS0 7-17/2 * * 1-5 (every 2h, 7–17, weekdays)
CRON_PHOTO_SYNCStudent photo sync0 5 * * 1-5 (5:00 AM, weekdays)
CRON_REGISTRATION_CODES_SYNCRegistration code dictionary sync0 7-17/1 * * 1-5 (hourly, 7–17, weekdays)
CRON_MARK_ABSENTMark unregistered students as absent10 8-12/1 * * 1-5 (hourly, 8:10–12:10, weekdays)

Storage / Images

VariableDescriptionDefault
STUDENTS_IMAGE_PHOTO_DIRFilesystem path for student photosstorage/img/students
STUDENTS_IMAGE_PHOTO_URL_PREFIXURL prefix for student photo serving/storage/img/students
VISITOR_IMAGE_DIRFilesystem path for visitor imagesstorage/img/visitors
VISITOR_IMAGE_URL_PREFIXURL prefix for visitor image serving/storage/img/visitors

Docker-Only Variables

These are used only in the Docker Compose setup:

VariableDescriptionDefault
MYSQL_ROOT_PASSWORDMySQL root password for the container