YAML Configuration File
Introduction
The Aether Framework uses a YAML configuration file (config.yaml
) to manage its settings. This file centralizes all configuration options, making it easy to customize the behavior of the framework.
This section explains:
The purpose of the configuration file.
How to modify the settings.
Best practices for secure key management using environment variables.
Structure of config.yaml
Here’s an example config.yaml
file with explanations for each section:
Editing the Configuration File
Open the
config.yaml
file:Located in the root directory of the project.
Update Settings:
Modify values as per your environment (e.g., development or production).
Example:
Add Environment-Specific Settings:
Use
development
,staging
, andproduction
YAML files.Load the appropriate file dynamically based on the environment:
Using Environment Variables
For sensitive data (e.g., API keys, Redis passwords), use environment variables instead of hardcoding them in the YAML file.
Steps:
Add environment variables to a
.env
file during development:Use these variables in the YAML file:
Load environment variables dynamically in code:
Best Practices
Don’t Hardcode Sensitive Data:
Always use environment variables for API keys, passwords, and other secrets.
Use Separate YAML Files for Environments:
Create
config.development.yaml
,config.staging.yaml
, andconfig.production.yaml
.
Document Your Changes:
If you add new configuration options, ensure they are documented in this section.
Example Workflow
Here’s an example workflow to set up your configuration:
Set the Environment:
Edit the YAML File: Update paths, hostnames, or thresholds based on your needs.
Run the Framework:
Common Issues
Missing Configuration File:
Error:
FileNotFoundError: config.yaml not found.
Solution: Ensure the
config.yaml
file is in the correct directory or specify the path explicitly.
Missing Environment Variables:
Error:
API key for openai not found.
Solution: Add the required environment variables or use a
.env
file.
Invalid YAML Syntax:
Error:
yaml.scanner.ScannerError
Solution: Validate your YAML file using an online YAML linter.
Last updated