Skip to content

Add .env file support for easier configuration#1

Open
RC-CHN wants to merge 1 commit intohe-yufeng:mainfrom
RC-CHN:main
Open

Add .env file support for easier configuration#1
RC-CHN wants to merge 1 commit intohe-yufeng:mainfrom
RC-CHN:main

Conversation

@RC-CHN
Copy link
Copy Markdown

@RC-CHN RC-CHN commented Apr 3, 2026

Motivation / 动机

Using command-line arguments to pass API keys and model settings can be inconvenient during testing and daily use. This PR adds support for reading configuration from .env files, making it easier to manage settings without repeatedly setting environment variables.

在测试和日常使用中,通过命令行参数传入 API 密钥和模型设置略有不便。本 PR 添加了从 .env 文件读取配置的功能,无需重复设置环境变量即可轻松管理配置。

Changes / 变更内容

  • Add python-dotenv dependency in pyproject.toml
  • Modify nanocoder/config.py to auto-load .env files (with graceful fallback if dotenv not installed)
  • Add .env.example with bilingual comments (Chinese/English)
  • Update README.md and README_CN.md with .env usage instructions

Usage / 使用方法

cp .env.example .env
# Edit .env with your API key and model settings
nanocoder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant