Environment Variable Configuration
The .env file is mainly used to configure the application runtime environment and parameters. It separates configuration from code and makes deployment management for different environments (development/test/production) easier. You can adjust application behavior by editing the configuration file without changing source code, improving deployment flexibility and security.
Copy the .env.example file in the root directory, rename it to .env, place it in the project root directory, and modify the values as needed.
Configuration Items
For a complete .env example, see .env.example. Below is a detailed explanation of each configuration item.
Node Environment
# node environment
NODE_ENV = productionService Configuration
PORT = 1236
SERVER_NAME = Umo Office ConvertLogging Configuration
LOG_DIR = ./logsFile Upload Configuration
# Maximum allowed upload size in MB
MAX_FILE_SIZE = 50Document Storage Path Configuration
UPLOAD_DIR = ./uploads/[year]/[month]
CONVERTED_DIR = ./converted/[year]/[month]Document Cover and Summary
# Whether to generate a document cover
ENABLE_COVER = true
# Document cover storage path
COVER_DIR = ./temp/cover/[year]/[month]
# Maximum summary length; truncate and append ellipsis if exceeded
SUMMARY_LENGTH = 200File Hash Algorithm Configuration
FILE_HASH_ALGORITHM = sha256MySQL Database Configuration
DB_HOST = localhost
DB_PORT = 3306
DB_USER = root
DB_PASSWORD =
DB_NAME = umo_office_convert
DB_TABLE_CONVERT_TASKS = convert_tasksWebhook Configuration
CONVERTED_WEBHOOK_URL =Important Notes
Path Variable Notes
[year],[month], and[day]are dynamic path variables. The system will automatically replace them based on the current date. For example,./uploads/[year]/[month]may generate a path like./uploads/2024/01.- If an upload directory is not specified, uploaded files will not be saved.
Security Notes
- Database password: set
DB_PASSWORDaccording to your environment. - File size limit: adjust
MAX_FILE_SIZEaccording to your needs to avoid exhausting server resources.
Hash Algorithm Selection
- The file hash algorithm is used to generate a unique identifier for a file. The supported algorithm list varies depending on your Node.js version, operating system, and OpenSSL version. Common algorithms include
md5,sha1,sha256, andsha512. - If you change the hash algorithm, ensure the length of the
hashfield in the database table is sufficient to store the hash value.
Webhook Functionality
CONVERTED_WEBHOOK_URLis used to receive file processing status notifications. The configured URL should acceptPOSTrequests without authorization.- When a file is uploaded or a file conversion is completed, the system will send a POST request to the configured Webhook URL, containing information related to the conversion task.
- Leaving it empty or not configuring it means the Webhook feature is not enabled.