fabriziosalmi / UglyFeed

Retrieve, aggregate, filter, evaluate, rewrite and serve RSS feeds using Large Language Models for fun, research and learning purposes
GNU Affero General Public License v3.0
124 stars 4 forks source link

Order of precedence for configuration parameters #24

Closed fabriziosalmi closed 4 months ago

fabriziosalmi commented 4 months ago

Describe the bug When developing an application meant to be shared through different methods like a pip package, Docker, or as pure Python, managing configuration effectively is crucial. The order of precedence for configuration parameters should follow a logical hierarchy that considers the flexibility and specificity of each method. Here’s a structured approach for determining the order of precedence:

General Principles:

  1. CLI Arguments: These should have the highest precedence because they are typically the most specific and are defined at runtime, providing immediate override capabilities.
  2. Environment Variables: These come next, offering a convenient way to configure applications without modifying code or configuration files.
  3. Configuration Files: These provide a persistent and centralized way to manage settings, suitable for defaults and shared settings.
  4. Defaults in Code: Hard-coded defaults in the application should be the fallback when no other configuration is provided.

Recommended Order of Precedence:

  1. Command Line Arguments (CLI Args)
  2. Environment Variables
  3. Configuration File (conga.yaml)
  4. Supplementary Files (feeds.txt)
  5. Defaults in Code

This order allows the most immediate and context-specific configurations (CLI arguments and environment variables) to override more general and persistent settings (configuration files and defaults).

fabriziosalmi commented 4 months ago

3fd59fe73f4000335e5c8c16dfa8df4ca4d9b1c6