1
This commit is contained in:
parent
08317cae00
commit
270076cf4e
16
README.md
16
README.md
@ -771,6 +771,22 @@ load_dotenv() # 加载 .env
|
|||||||
api_key = os.getenv("DEEPSEEK_API_KEY")
|
api_key = os.getenv("DEEPSEEK_API_KEY")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> **安全最佳实践**:
|
||||||
|
> 1. **添加 `.env` 到 `.gitignore`**:确保 `.gitignore` 文件中包含 `.env`,防止 API Key 被误上传到 Git 仓库。
|
||||||
|
> 2. **创建 `.env-example` 模板文件**:在项目中提供一个 `.env-example` 文件,列出所需的环境变量 (但**不包含真实的 Key**),方便其他开发者或组员快速配置。
|
||||||
|
>
|
||||||
|
> ```bash
|
||||||
|
> # .env-example 文件内容 (提交到 Git)
|
||||||
|
> DEEPSEEK_API_KEY=your_api_key_here
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> 组员克隆项目后,只需:
|
||||||
|
> ```bash
|
||||||
|
> cp .env-example .env # 复制模板
|
||||||
|
> # 然后编辑 .env 填入自己的 API Key
|
||||||
|
> ```
|
||||||
|
|
||||||
|
|
||||||
### 4. Git 简明操作手册 (Cheatsheet)
|
### 4. Git 简明操作手册 (Cheatsheet)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user