DPASS-REST is a RESTful API implementation built on the Slim Framework.
A full reference of all available RESTful endpoints, including request/response examples, validation rules, and error codes, is available in the following language versions:
| Language | Document |
|---|---|
| English | API.en.md |
| 中文 (Chinese) | API.zh.md |
The documentation covers:
- Authentication via API Key
- All available endpoints (
/add,/addbatch,/find,/revoke,/check,/check_profile,/approve,/disapprove) - Request parameters and field constraints
- Success and error response formats
The database schema is provided in the dpass-rest.sql file. To set up the database:
# Create the database
CREATE DATABASE `dpass-lite` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
# Import the schema
mysql -u username -p dpass-lite < dpass-rest.sqlThe schema includes the following tables:
- api_keys - API authentication key management
- configurations - System-wide configuration parameters
- log - Application activity and audit log
- records - Main records table for entry data
- record_approvals - Approval workflow for records
- record_status - Status tracking for records
- staffs - Staff information and work schedules
This application is available as a Docker image: wengpang/dpass
As of version 1.2.0, the application supports configuration through environment variables, making it suitable for containerized deployments.
The following environment variables are supported for database configuration:
| Environment Variable | Description | Default Value |
|---|---|---|
DB_HOST |
Database host address | 127.0.0.1 |
DB_NAME |
Database name | dpass-lite |
DB_USER |
Database username | dpass-lite |
DB_PASSWORD |
Database password | dpass-lite |
docker run -d \
-p 8080:8080 \
-e DB_HOST=mysql-server \
-e DB_NAME=your_database \
-e DB_USER=your_username \
-e DB_PASSWORD=your_password \
wengpang/dpass:latestCreate a docker-compose.yml file:
version: '3.8'
services:
dpass:
image: wengpang/dpass:latest
ports:
- "8080:8080"
environment:
DB_HOST: mysql-server
DB_NAME: your_database
DB_USER: your_username
DB_PASSWORD: your_passwordThen run:
docker-compose up -dCreate a .env file:
DB_HOST=mysql-server
DB_NAME=your_database
DB_USER=your_username
DB_PASSWORD=your_passwordImportant: Add .env to your .gitignore file to prevent committing sensitive information.
Create a docker-compose.yml file:
version: '3.8'
services:
dpass:
image: wengpang/dpass:latest
ports:
- "8080:8080"
env_file:
- .envThe application reads database configuration in the following order (preferred method listed first):
- Environment variables (preferred method)
- Hardcoded defaults in
DatabaseConfiguration.php(fallback)
This approach ensures:
- Security: Sensitive credentials are not baked into the Docker image
- Flexibility: Same image can be used across different environments
- Backward compatibility: Existing deployments continue to work without changes
The DatabaseConfiguration.php file is included in the repository with environment variable support and safe default values. The application will automatically use environment variables when they are set, overriding any hardcoded values.
For local development or non-Docker deployments, you can edit DatabaseConfiguration.php directly to change the default values if needed.
You need PHP >= 5.3.0. If you use encrypted cookies, you'll also need the mcrypt extension.