diff --git a/backend/utils/config.js b/backend/utils/config.js index e4fa34c..b573adc 100644 --- a/backend/utils/config.js +++ b/backend/utils/config.js @@ -13,16 +13,21 @@ const CONFIG_CACHE_TTL = 5000; // 5秒缓存 function getConfigDir() { // Check if running on fnOS if (process.env.TRIM_PKGVAR) { + console.log('📁 配置目录 (fnOS): ' + process.env.TRIM_PKGVAR); return process.env.TRIM_PKGVAR; } // Windows if (process.platform === 'win32') { - return path.join(process.env.APPDATA || os.homedir(), 'FlyPic'); + const dir = path.join(process.env.APPDATA || os.homedir(), 'FlyPic'); + console.log('📁 配置目录 (Windows): ' + dir); + return dir; } // Linux/Mac - return path.join(os.homedir(), '.flypic'); + const dir = path.join(os.homedir(), '.flypic'); + console.log('📁 配置目录 (Linux/Mac): ' + dir); + return dir; } /** diff --git a/flypic/cmd/main b/flypic/cmd/main index 9cfe4c2..0659b87 100644 --- a/flypic/cmd/main +++ b/flypic/cmd/main @@ -16,8 +16,17 @@ if [ -f "$PORT_CONF" ]; then fi APP_PORT="${APP_PORT:-15002}" +# 导出飞牛环境变量,确保 Node.js 进程能访问 +export TRIM_PKGVAR +export TRIM_PKGETC +export TRIM_APPDEST +export TRIM_PKGHOME +export TRIM_DATA_SHARE_PATHS +export DATA_DIR="${DATA_DIR}" +export PORT="${APP_PORT}" + # 启动命令 -CMD="DATA_DIR=${DATA_DIR} PORT=${APP_PORT} node ${TRIM_APPDEST}/server/server.js" +CMD="node ${TRIM_APPDEST}/server/server.js" log_msg() { local msg="$(date '+%Y-%m-%d %H:%M:%S') - $1"