google / google/python-fire

Add support for environment variable configuration

Đang mở
#634 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
28.2k
Fork
1.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.