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
- Clone the repository:
git clone <repository-url>
cd environmentvariableservice
- Install dependencies:
pip install -r requirements.txt
Usage
- Set environment variables (optional):
export NAME="Your Name"
- Run the application:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
- 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
Description
Languages
Python
100%