2 lines
12 KiB
JavaScript
2 lines
12 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 文件采用 INI 分组格式,[SECTION] 表示分组,分组下的 KEY = value 对应该分组的配置项。","frontmatter":{},"headers":[],"relativePath":"zh/appendix/config-reference.md","filePath":"zh/appendix/config-reference.md"}'),a={name:"zh/appendix/config-reference.md"};function r(h,t,i,l,n,b){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><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> 文件采用 INI 分组格式,<code>[SECTION]</code> 表示分组,分组下的 <code>KEY = value</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_DEBUG</code></td><td><code>true</code></td><td>调试模式(生产环境设为 false)</td></tr></tbody></table><h3 id="应用配置-APP-" tabindex="-1">应用配置 <code>[APP]</code> <a class="header-anchor" href="#应用配置-APP-" aria-label="Permalink to "应用配置 `[APP]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>DEFAULT_TIMEZONE</code></td><td><code>Asia/Shanghai</code></td><td>默认时区</td></tr><tr><td><code>DEMO</code></td><td><code>false</code></td><td>演示模式(开启后拦截写操作)</td></tr><tr><td><code>SHOW_ERROR_MSG</code></td><td><code>true</code></td><td>显示错误详情(生产环境设为 false)</td></tr></tbody></table><h3 id="数据库配置-DATABASE-" tabindex="-1">数据库配置 <code>[DATABASE]</code> <a class="header-anchor" href="#数据库配置-DATABASE-" aria-label="Permalink to "数据库配置 `[DATABASE]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>TYPE</code></td><td><code>mysql</code></td><td>数据库类型:mysql / pgsql / sqlsrv / oracle / sqlite</td></tr><tr><td><code>HOSTNAME</code></td><td><code>127.0.0.1</code></td><td>数据库主机</td></tr><tr><td><code>DATABASE</code></td><td>-</td><td>数据库名(SQLite 为文件路径)</td></tr><tr><td><code>USERNAME</code></td><td><code>root</code></td><td>数据库用户</td></tr><tr><td><code>PASSWORD</code></td><td>-</td><td>数据库密码</td></tr><tr><td><code>HOSTPORT</code></td><td><code>3306</code></td><td>数据库端口</td></tr><tr><td><code>CHARSET</code></td><td><code>utf8mb4</code></td><td>字符集</td></tr><tr><td><code>DEBUG</code></td><td><code>true</code></td><td>是否开启 SQL 调试</td></tr><tr><td><code>PREFIX</code></td><td><code>think_</code></td><td>表前缀</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-配置-JWT-" tabindex="-1">JWT 配置 <code>[JWT]</code> <a class="header-anchor" href="#JWT-配置-JWT-" aria-label="Permalink to "JWT 配置 `[JWT]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>SECRET</code></td><td>内置默认</td><td>签名密钥(<strong>生产环境务必修改</strong>)</td></tr><tr><td><code>ACCESS_TTL</code></td><td><code>7200</code></td><td>access_token 有效期(秒)</td></tr><tr><td><code>REFRESH_TTL</code></td><td><code>604800</code></td><td>refresh_token 有效期(秒)</td></tr><tr><td><code>ISSUER</code></td><td><code>rxthinkcmf</code></td><td>签发者标识</td></tr></tbody></table><h3 id="文件上传配置-FILE-" tabindex="-1">文件上传配置 <code>[FILE]</code> <a class="header-anchor" href="#文件上传配置-FILE-" aria-label="Permalink to "文件上传配置 `[FILE]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>UPLOAD_DIR</code></td><td>-</td><td>上传根目录(绝对路径)</td></tr><tr><td><code>DOMAIN_URL</code></td><td>-</td><td>文件访问域名</td></tr><tr><td><code>IMAGE_EXT</code></td><td><code>gif,jpg,jpeg,png,bmp,webp,svg</code></td><td>图片允许后缀</td></tr><tr><td><code>FILE_EXT</code></td><td>多种后缀</td><td>文件允许后缀</td></tr><tr><td><code>MAX_SIZE</code></td><td><code>10</code></td><td>最大文件大小(MB)</td></tr></tbody></table><h3 id="缓存配置-CACHE-" tabindex="-1">缓存配置 <code>[CACHE]</code> <a class="header-anchor" href="#缓存配置-CACHE-" aria-label="Permalink to "缓存配置 `[CACHE]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>DRIVER</code></td><td><code>file</code></td><td>缓存驱动:file / redis</td></tr><tr><td><code>REDIS_HOST</code></td><td><code>127.0.0.1</code></td><td>Redis 主机(driver=redis 时生效)</td></tr><tr><td><code>REDIS_PORT</code></td><td><code>6379</code></td><td>Redis 端口(driver=redis 时生效)</td></tr><tr><td><code>REDIS_PASSWORD</code></td><td>-</td><td>Redis 密码</td></tr><tr><td><code>REDIS_DB</code></td><td><code>0</code></td><td>Redis 数据库编号</td></tr><tr><td><code>REDIS_PREFIX</code></td><td><code>rx:</code></td><td>缓存键前缀</td></tr></tbody></table><h3 id="CORS-配置-CORS-" tabindex="-1">CORS 配置 <code>[CORS]</code> <a class="header-anchor" href="#CORS-配置-CORS-" aria-label="Permalink to "CORS 配置 `[CORS]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>ALLOW_ORIGIN</code></td><td><code>*</code></td><td>允许的跨域来源</td></tr></tbody></table><h3 id="API-配置-API-" tabindex="-1">API 配置 <code>[API]</code> <a class="header-anchor" href="#API-配置-API-" aria-label="Permalink to "API 配置 `[API]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>CAMEL_SNAKE_CONVERT</code></td><td><code>true</code></td><td>驼峰/下划线自动转换</td></tr><tr><td><code>PROXY_IPS</code></td><td>(空)</td><td>受信代理 IP 列表(逗号分隔,支持 CIDR)。部署在 CDN/负载均衡后面时配置,中间件会从 <code>X-Forwarded-For</code> / <code>X-Real-IP</code> 头提取真实客户端 IP。未配置时默认信任 <code>127.0.0.1</code> 和 <code>::1</code>。</td></tr></tbody></table><h3 id="验证码配置-CAPTCHA-" tabindex="-1">验证码配置 <code>[CAPTCHA]</code> <a class="header-anchor" href="#验证码配置-CAPTCHA-" aria-label="Permalink to "验证码配置 `[CAPTCHA]`""></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>20</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></td><td><code>160</code></td><td>图片宽度(像素)</td></tr><tr><td><code>CAPTCHA_IMAGE_HEIGHT</code></td><td><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>8</code></td><td>干扰线数量</td></tr><tr><td><code>CAPTCHA_NOISE_DOTS</code></td><td><code>500</code></td><td>噪点数量</td></tr></tbody></table><h3 id="代码生成器配置-GENERATOR-" tabindex="-1">代码生成器配置 <code>[GENERATOR]</code> <a class="header-anchor" href="#代码生成器配置-GENERATOR-" aria-label="Permalink to "代码生成器配置 `[GENERATOR]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>PARENT_MENU_ID</code></td><td><code>189</code></td><td>生成模块的父菜单ID</td></tr><tr><td><code>APP_NAME</code></td><td><code>tool</code></td><td>模块应用名(路由前缀)</td></tr></tbody></table><h3 id="国际化配置-LANG-" tabindex="-1">国际化配置 <code>[LANG]</code> <a class="header-anchor" href="#国际化配置-LANG-" aria-label="Permalink to "国际化配置 `[LANG]`""></a></h3><table tabindex="0"><thead><tr><th>变量</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>default_lang</code></td><td><code>zh-cn</code></td><td>默认语言</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>变量</th><th>说明</th></tr></thead><tbody><tr><td><code>VITE_GLOB_API_URL</code></td><td>API 基础路径(如 <code>/api</code>)</td></tr><tr><td><code>VITE_GLOB_API_URL_PREFIX</code></td><td>API 前缀</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>[DATABASE]</code></td><td><code>config/database.php</code></td><td><code>type</code> / <code>hostname</code> / <code>database</code> / <code>username</code> / <code>password</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></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>max_size</code></td></tr><tr><td><code>[CACHE]</code></td><td><code>config/cache.php</code></td><td><code>driver</code> / <code>redis_host</code> / <code>redis_port</code></td></tr><tr><td><code>[CORS]</code></td><td><code>config/cors.php</code></td><td><code>allow_origin</code></td></tr><tr><td><code>[API]</code></td><td><code>config/api.php</code></td><td><code>camel_snake_convert</code></td></tr><tr><td><code>[CAPTCHA]</code></td><td>无配置文件,<code>CaptchaService</code> 直接读取 <code>env()</code></td><td><code>captcha_bypass_code</code> / <code>captcha_length</code> / <code>captcha_expire</code></td></tr><tr><td><code>[LANG]</code></td><td><code>config/lang.php</code></td><td><code>default_lang</code></td></tr><tr><td>—</td><td><code>config/tenant.php</code></td><td><code>default_tenant_id</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>',33)])])}const E=d(a,[["render",r]]);export{s as __pageData,E as default};
|