2025-05-27 22:16:57 +00:00

65 lines
1.4 KiB
Markdown

# Environment Variable Service
A simple FastAPI application that returns the value of environment variables, specifically designed to return the value of the `NAME` environment variable.
## Features
- Get the value of the `NAME` environment variable
- Get the value of any environment variable by name
- Health check endpoint to verify service status
## Installation
1. Clone the repository:
```bash
git clone <repository-url>
cd environmentvariableservice
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
## Usage
1. Set environment variables (optional):
```bash
export NAME="Your Name"
```
2. Run the application:
```bash
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
```
3. Access the API:
- API documentation: http://localhost:8000/docs
- Alternative API documentation: http://localhost:8000/redoc
- OpenAPI specification: http://localhost:8000/openapi.json
## API Endpoints
### Get NAME environment variable
```
GET /env/name
```
Returns the value of the `NAME` environment variable.
### Get any environment variable
```
GET /env/{variable_name}
```
Returns the value of the specified environment variable.
### Health Check
```
GET /health
```
Returns the status of the service.
## Development
- The application uses FastAPI for the REST API
- Environment variables are accessed via the Python `os` module
- Ruff is used for linting and code formatting