google / google/python-fire

Add support for environment variable configuration

オープン
#634 コメント 1 件 リアクション 1 件 担当者 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 を短くまとめたダイジェスト。