2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
import{_ as d,o as e,c as o,a2 as c}from"./chunks/framework.B-QBKwc1.js";const s=JSON.parse('{"title":"配置项速查","description":"本页速查后端 .env 与前端环境变量全部配置项,含键名、默认值与说明,排查配置问题或部署调优时对照本表。","frontmatter":{},"headers":[],"relativePath":"zh/appendix/config-reference.md","filePath":"zh/appendix/config-reference.md"}'),r={name:"zh/appendix/config-reference.md"};function a(h,t,i,n,p,l){return e(),o("div",null,[...t[0]||(t[0]=[c('<h1 id="C-配置项速查" tabindex="-1">C. 配置项速查 <a class="header-anchor" href="#C-配置项速查" aria-label="Permalink to "C. 配置项速查""></a></h1><div class="tip custom-block"><p class="custom-block-title">概述</p><p>本页速查后端 .env 与前端环境变量全部配置项,含键名、默认值与说明,排查配置问题或部署调优时对照本表。</p></div><h2 id="后端-env-配置" tabindex="-1">后端 .env 配置 <a class="header-anchor" href="#后端-env-配置" aria-label="Permalink to "后端 .env 配置""></a></h2><div class="tip custom-block"><p class="custom-block-title">格式说明</p><p>本项目 <code>.env</code> 为<strong>扁平键名</strong>(无分组段),遵循 Laravel 约定;键名与 <code>config/*.php</code> 中的 <code>env()</code> 读取一一对应。</p></div><h3 id="应用配置" tabindex="-1">应用配置 <a class="header-anchor" href="#应用配置" aria-label="Permalink to "应用配置""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>APP_ENV</code></td><td><code>local</code>(示例)</td><td>运行环境(生产设为 <code>production</code>)</td></tr><tr><td><code>APP_DEBUG</code></td><td><code>true</code></td><td>调试模式(生产环境设为 false)</td></tr><tr><td><code>APP_KEY</code></td><td>-</td><td>应用密钥(<code>php artisan key:generate</code> 生成)</td></tr><tr><td><code>APP_URL</code></td><td><code>http://localhost</code></td><td>应用地址</td></tr><tr><td><code>DEMO_MODE</code></td><td><code>false</code></td><td>演示模式开关</td></tr><tr><td><code>TRUSTED_PROXIES</code></td><td>(空)</td><td>受信代理 IP(逗号分隔,支持 CIDR),未配置时默认信任 <code>127.0.0.1</code> 和 <code>::1</code></td></tr><tr><td><code>DEFAULT_TENANT_ID</code></td><td><code>1</code></td><td>默认租户ID,超管操作租户隔离表时自动代入(<code>config/tenant.php</code>)</td></tr></tbody></table><h3 id="数据库配置" tabindex="-1">数据库配置 <a class="header-anchor" href="#数据库配置" aria-label="Permalink to "数据库配置""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>DB_CONNECTION</code></td><td><code>sqlite</code></td><td>数据库类型:mysql / pgsql / sqlsrv / oracle / sqlite</td></tr><tr><td><code>DB_HOST</code></td><td><code>127.0.0.1</code></td><td>数据库主机</td></tr><tr><td><code>DB_DATABASE</code></td><td>-</td><td>数据库名(SQLite 为文件路径)</td></tr><tr><td><code>DB_USERNAME</code></td><td>-</td><td>数据库用户</td></tr><tr><td><code>DB_PASSWORD</code></td><td>-</td><td>数据库密码</td></tr><tr><td><code>DB_PORT</code></td><td><code>3306</code></td><td>数据库端口</td></tr><tr><td><code>DB_CHARSET</code></td><td><code>utf8mb4</code></td><td>字符集</td></tr><tr><td><code>DB_PREFIX</code></td><td><code>laravel_</code></td><td>表前缀(<strong>与 SQL 脚本一致,勿改</strong>)</td></tr></tbody></table><p>各数据库默认端口:</p><table tabindex="0"><thead><tr><th>数据库</th><th>默认端口</th><th>默认用户</th></tr></thead><tbody><tr><td>MySQL</td><td>3306</td><td>root</td></tr><tr><td>PostgreSQL</td><td>5432</td><td>postgres</td></tr><tr><td>SQL Server</td><td>1433</td><td>sa</td></tr><tr><td>Oracle</td><td>1521</td><td>-</td></tr><tr><td>SQLite</td><td>-</td><td>-</td></tr></tbody></table><h3 id="JWT-配置-config-jwt-php-" tabindex="-1">JWT 配置(<code>config/jwt.php</code>) <a class="header-anchor" href="#JWT-配置-config-jwt-php-" aria-label="Permalink to "JWT 配置(`config/jwt.php`)""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>JWT_SECRET</code></td><td>(空)</td><td>签名密钥(≥32 字符,<strong>缺失/过短 fail-close</strong>,生产环境务必修改)</td></tr><tr><td><code>JWT_ACCESS_TTL</code></td><td><code>7200</code></td><td>access_token 有效期(秒)</td></tr><tr><td><code>JWT_REFRESH_TTL</code></td><td><code>604800</code></td><td>refresh_token 有效期(秒)</td></tr><tr><td><code>JWT_PERMS_TTL</code></td><td><code>7200</code></td><td>权限缓存有效期(秒)</td></tr><tr><td><code>JWT_ISSUER</code></td><td><code>rxthinkcmf</code></td><td>签发者标识</td></tr></tbody></table><h3 id="文件上传配置-config-file-php-" tabindex="-1">文件上传配置(<code>config/file.php</code>) <a class="header-anchor" href="#文件上传配置-config-file-php-" aria-label="Permalink to "文件上传配置(`config/file.php`)""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>FILE_UPLOAD_DIR</code></td><td><code>uploads</code></td><td>上传根目录(相对 <code>public/</code>)</td></tr><tr><td><code>FILE_DOMAIN_URL</code></td><td>(空)</td><td>文件访问域名(留空按当前请求域名补全)</td></tr><tr><td><code>FILE_IMAGE_EXT</code></td><td><code>gif,jpg,jpeg,png,bmp,webp</code></td><td>图片允许后缀</td></tr><tr><td><code>FILE_EXT</code></td><td>多种后缀</td><td>文件允许后缀</td></tr><tr><td><code>FILE_MAX_SIZE</code></td><td><code>10</code></td><td>最大文件大小(MB)</td></tr></tbody></table><h3 id="会话-缓存-队列-Redis-必需-" tabindex="-1">会话 / 缓存 / 队列(Redis 必需) <a class="header-anchor" href="#会话-缓存-队列-Redis-必需-" aria-label="Permalink to "会话 / 缓存 / 队列(Redis 必需)""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>SESSION_DRIVER</code></td><td><code>redis</code></td><td>会话驱动</td></tr><tr><td><code>SESSION_LIFETIME</code></td><td><code>120</code></td><td>会话过期(分钟)</td></tr><tr><td><code>CACHE_STORE</code></td><td><code>redis</code></td><td>缓存驱动</td></tr><tr><td><code>QUEUE_CONNECTION</code></td><td><code>redis</code></td><td>队列驱动</td></tr><tr><td><code>REDIS_CLIENT</code></td><td><code>phpredis</code></td><td>Redis PHP 扩展</td></tr><tr><td><code>REDIS_HOST</code></td><td><code>127.0.0.1</code></td><td>Redis 主机</td></tr><tr><td><code>REDIS_PORT</code></td><td><code>6379</code></td><td>Redis 端口</td></tr><tr><td><code>REDIS_PASSWORD</code></td><td><code>null</code></td><td>Redis 密码</td></tr></tbody></table><h3 id="CORS-配置-config-cors-php-" tabindex="-1">CORS 配置(<code>config/cors.php</code>) <a class="header-anchor" href="#CORS-配置-config-cors-php-" aria-label="Permalink to "CORS 配置(`config/cors.php`)""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>CORS_ALLOW_ORIGIN</code></td><td><code>*</code></td><td>允许的跨域来源(生产环境限制为实际域名)</td></tr></tbody></table><h3 id="API-配置-config-api-php-" tabindex="-1">API 配置(<code>config/api.php</code>) <a class="header-anchor" href="#API-配置-config-api-php-" aria-label="Permalink to "API 配置(`config/api.php`)""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>API_CAMEL_SNAKE_CONVERT</code></td><td><code>true</code></td><td>驼峰/下划线自动转换</td></tr></tbody></table><h3 id="验证码配置-config-captcha-php-" tabindex="-1">验证码配置(<code>config/captcha.php</code>) <a class="header-anchor" href="#验证码配置-config-captcha-php-" aria-label="Permalink to "验证码配置(`config/captcha.php`)""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>CAPTCHA_BYPASS_CODE</code></td><td>(空)</td><td>万能验证码,仅开发调试用,<strong>生产环境务必留空</strong></td></tr><tr><td><code>CAPTCHA_LENGTH</code></td><td><code>6</code></td><td>验证码字符长度(4-6位)</td></tr><tr><td><code>CAPTCHA_EXPIRE</code></td><td><code>300</code></td><td>过期时间(秒)</td></tr><tr><td><code>CAPTCHA_RATE_WINDOW</code></td><td><code>60</code></td><td>防刷窗口期(秒)</td></tr><tr><td><code>CAPTCHA_RATE_LIMIT</code></td><td><code>10</code></td><td>窗口期内最大获取次数</td></tr><tr><td><code>CAPTCHA_CHARS</code></td><td><code>ABCDEFGHJKLMNPQRSTUVWXYZ2346789</code></td><td>字符集</td></tr><tr><td><code>CAPTCHA_FONT_PATH</code></td><td><code>static/fonts/Vera.ttf</code></td><td>字体路径</td></tr><tr><td><code>CAPTCHA_IMAGE_WIDTH</code> / <code>HEIGHT</code></td><td><code>160</code> / <code>50</code></td><td>图片尺寸(像素)</td></tr><tr><td><code>CAPTCHA_FONT_SIZE</code></td><td><code>28</code></td><td>字体大小</td></tr><tr><td><code>CAPTCHA_NOISE_LINES</code></td><td><code>6</code></td><td>干扰线数量</td></tr><tr><td><code>CAPTCHA_NOISE_DOTS</code></td><td><code>300</code></td><td>噪点数量</td></tr></tbody></table><h3 id="代码生成器配置-config-generator-php-" tabindex="-1">代码生成器配置(<code>config/generator.php</code>) <a class="header-anchor" href="#代码生成器配置-config-generator-php-" aria-label="Permalink to "代码生成器配置(`config/generator.php`)""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>GENERATOR_PARENT_MENU_ID</code></td><td><code>189</code></td><td>生成模块的父菜单ID</td></tr><tr><td><code>GENERATOR_APP_NAME</code></td><td><code>tool</code></td><td>模块应用名(路由前缀、前端目录)</td></tr></tbody></table><h2 id="前端环境变量-ui-env-" tabindex="-1">前端环境变量(<code>ui/.env*</code>) <a class="header-anchor" href="#前端环境变量-ui-env-" aria-label="Permalink to "前端环境变量(`ui/.env*`)""></a></h2><table tabindex="0"><thead><tr><th>变量</th><th>说明</th></tr></thead><tbody><tr><td><code>VITE_GLOB_API_URL</code></td><td>API 基础路径(留空表示同源)</td></tr><tr><td><code>VITE_GLOB_API_URL_PREFIX</code></td><td>API 前缀(默认 <code>/api</code>)</td></tr><tr><td><code>VITE_GLOB_UPLOAD_URL</code></td><td>图片上传地址(跨域部署时配置)</td></tr><tr><td><code>VITE_GLOB_IMG_URL</code></td><td>图片前缀地址</td></tr><tr><td><code>VITE_PORT</code></td><td>开发端口(默认 8001)</td></tr><tr><td><code>VITE_DROP_CONSOLE</code></td><td>构建时删除 console</td></tr></tbody></table><h2 id="配置文件对照" tabindex="-1">配置文件对照 <a class="header-anchor" href="#配置文件对照" aria-label="Permalink to "配置文件对照""></a></h2><table tabindex="0"><thead><tr><th>.env 变量前缀</th><th>配置文件</th><th>主要配置键</th></tr></thead><tbody><tr><td><code>DB_*</code></td><td><code>config/database.php</code></td><td><code>default</code> / <code>connections.*</code></td></tr><tr><td><code>JWT_*</code></td><td><code>config/jwt.php</code></td><td><code>secret</code> / <code>access_ttl</code> / <code>refresh_ttl</code> / <code>perms_ttl</code> / <code>issuer</code></td></tr><tr><td><code>FILE_*</code></td><td><code>config/file.php</code></td><td><code>upload_dir</code> / <code>domain_url</code> / <code>temp_dir</code> / <code>image_ext</code> / <code>file_ext</code> / <code>max_size</code></td></tr><tr><td><code>CACHE_STORE</code> / <code>REDIS_*</code></td><td><code>config/cache.php</code>、<code>config/database.php</code></td><td><code>default</code> / <code>stores.redis</code></td></tr><tr><td><code>CORS_ALLOW_ORIGIN</code></td><td><code>config/cors.php</code></td><td><code>allow_origin</code></td></tr><tr><td><code>API_CAMEL_SNAKE_CONVERT</code></td><td><code>config/api.php</code></td><td><code>camel_snake_convert</code> / <code>convert_except_params</code></td></tr><tr><td><code>CAPTCHA_*</code></td><td><code>config/captcha.php</code></td><td>全部验证码参数</td></tr><tr><td><code>GENERATOR_*</code></td><td><code>config/generator.php</code></td><td><code>parent_menu_id</code> / <code>app_name</code> / <code>template_dir</code> / <code>backend_outputs</code></td></tr><tr><td><code>DEFAULT_TENANT_ID</code></td><td><code>config/tenant.php</code></td><td><code>default_tenant_id</code></td></tr><tr><td><code>TRUSTED_PROXIES</code></td><td><code>config/app.php</code></td><td><code>trusted_proxies</code></td></tr><tr><td><code>APP_TIMEZONE</code></td><td><code>config/app.php</code></td><td><code>timezone</code></td></tr></tbody></table><h3 id="租户配置" tabindex="-1">租户配置 <a class="header-anchor" href="#租户配置" aria-label="Permalink to "租户配置""></a></h3><table tabindex="0"><thead><tr><th>配置文件</th><th>配置键</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>config/tenant.php</code></td><td><code>default_tenant_id</code></td><td><code>1</code></td><td>默认租户ID,超管操作租户隔离表时自动代入</td></tr></tbody></table>',30)])])}const b=d(r,[["render",a]]);export{s as __pageData,b as default};
|