Overview
Splat uses environment variables for configuration, loaded from.env files using python-dotenv. This page documents all available environment variables.
Required Variables
These variables must be set for Splat to function:Your Groq API key for accessing AI models. Used by the main error processing pipeline.Where to get it: Groq Console → API Keys
.env
Alternative API key variable used by the agent system. Should typically be set to the same value as
API..env
Both
API and API_KEY are required as different components of Splat reference different variable names.Optional Variables
The Groq model to use for error analysis. Used by the agent system.Available models:
.env
llama3-70b-8192- Best for complex error analysis (recommended)llama3-8b-8192- Faster, suitable for simpler errorsmixtral-8x7b-32768- Alternative with larger context window
Configuration Example
Here’s a complete.env file example:
.env
Environment Variable Loading
Splat loads environment variables usingpython-dotenv in the following order:
- System environment variables - Highest priority
- Project
.envfile - In your current working directory - Home
.envfile - In your home directory
Variables defined in higher priority locations override those in lower priority locations.
Usage in Code
Splat accesses environment variables in two main locations:Error Processing Pipeline
File:process/process.py:11
API variable is used to initialize the Groq client for error analysis.
Agent System
File:agents/agents.py:37-38
MODEL and API_KEY variables configure the AI agent for debugging.
Security Best Practices
Recommended Security Measures
-
Never commit
.envfiles Add to.gitignore:.gitignore -
Use
.env.examplefor documentation Create a template without sensitive values:.env.example -
Set proper file permissions
- Use different keys per environment Maintain separate API keys for development, staging, and production.
- Rotate keys regularly Generate new API keys periodically in the Groq Console.
Validation
You can verify your environment variables are loaded correctly:This will show whether variables are set without exposing the actual values.
Troubleshooting
Variables Not Loading
Problem: Environment variables are not being recognized. Solutions:- Verify
.envfile is in the correct directory - Check for typos in variable names
- Ensure no spaces around the
=sign - Try using absolute paths:
load_dotenv('/absolute/path/to/.env')
API Key Invalid
Problem: Getting authentication errors from Groq API. Solutions:- Verify the API key is correct in
.env - Check that the key hasn’t expired
- Ensure you’re using the correct key (Groq keys start with
gsk_) - Generate a new key in the Groq Console
Model Not Found
Problem: Error about model not being available. Solutions:- Verify the model name is spelled correctly
- Check Groq’s available models
- Use the default by removing the
MODELvariable
Environment-Specific Configuration
For different environments, you can use multiple.env files:
Related Resources
Initial Setup
Step-by-step setup guide
Groq API
Learn about Groq API configuration
Troubleshooting
Common issues and solutions
Security
Security best practices