google / google/python-fire

Add support for environment variable configuration

未关闭
#634 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
28.2k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

描述

### Problem

Currently, Python Fire CLI tools require all configuration to be passed via command-line arguments. For sensitive data or frequently used configurations, this can be cumbersome and insecure.

### Proposed Solution

Add support for reading configuration values from environment variables with a naming convention like `FIRE_`.

### Example Usage
```markdown
python import fire

def deploy(api_key, region='us-east-1'):
"""Deploy application"""
print(f"Deploying to {region} with key {api_key}")

if __name__ == '__main__':
fire.Fire(deploy)
```

Current usage (exposes secret):
```markdown
‍‍python deploy.py --api-key=secret123 --region=eu-west-1
```

Proposed usage:
```markdown
export FIRE_API_KEY=secret123
python deploy.py --region=eu-west-1
```

### Benefits

- Security: Sensitive data not exposed in process lists
- Convenience: Reduce repetitive argument typing
- DevOps: Better integration with container/cloud environments

### Alternative Considered
Using config files, but environment variables are more standard in modern deployment workflows.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。