Metadata-Version: 2.4
Name: env-sentinel
Version: 0.1.2
Summary: Validate environment variables at startup — fail fast with clear errors.
Project-URL: Homepage, https://github.com/sathish-2000/env-sentinel
Author-email: SathishKumarS <iamsathi95@gmail.com>
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# env-sentinel

**Validate environment variables at startup — fail fast with clear errors.**

Most apps read environment variables scattered throughout the codebase. When one is missing or mistyped, the failure surfaces at runtime — often deep in a request handler, minutes or hours after startup. `env-sentinel` moves that failure to the very beginning: call `require()` once at startup with your expected variables and types, and get a single, readable error listing every problem before your app ever handles traffic.

## Install

```bash
pip install env-sentinel
```

## Usage

```python
from env_sentinel import require

config = require({
    "DATABASE_URL": str,
    "PORT": int,
    "DEBUG": bool,
    "THRESHOLD": float,
})

# config["PORT"] is already an int, config["DEBUG"] is already a bool
```

If anything is wrong, you get a single `EnvironmentError` listing all failures:

```
EnvironmentError: Environment validation failed:
  - PORT: missing
  - DEBUG: cannot convert 'maybe' to bool (accepted: true/1/yes or false/0/no)
```

## Supported types

| Type    | Example env value       | Python value  |
|---------|-------------------------|---------------|
| `str`   | `hello`                 | `"hello"`     |
| `int`   | `8080`                  | `8080`        |
| `float` | `0.75`                  | `0.75`        |
| `bool`  | `true` / `1` / `yes`   | `True`        |
| `bool`  | `false` / `0` / `no`   | `False`        |

Bool matching is case-insensitive.

## License

MIT
