Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Latest commit

 

History

History
66 lines (46 loc) · 2.46 KB

File metadata and controls

66 lines (46 loc) · 2.46 KB

Release Notes

Environment Variable Management Improvements

Overview

This release introduces a new approach to environment variable management in the DPF project. The changes improve maintainability, reduce duplication, and provide a more consistent way to handle configuration across all scripts.

Key Changes

1. Centralized Environment Configuration

  • Created a new .env file that contains all environment variables with their default values
  • Organized variables into logical sections with clear comments
  • Removed redundant variable definitions from the Makefile

2. New Environment Loading Script

  • Added scripts/env.sh to handle environment variable loading
  • Implemented robust error handling for missing .env file
  • Added support for comments and empty lines in the .env file
  • Properly handles quoted values in the environment file

3. Simplified Makefile

  • Removed all environment variable definitions from the Makefile
  • Maintained the include .env directive to ensure Make has access to variables
  • Kept all targets and help documentation intact

4. Updated Script Structure

  • Modified scripts to source the environment variables from env.sh
  • Used $(dirname "$0")/env.sh to ensure scripts can find the environment file regardless of where they're called from
  • Maintained backward compatibility with existing script functionality

Benefits

  1. Improved Maintainability: Environment variables are now defined in a single location
  2. Better Organization: Variables are grouped by functionality with clear comments
  3. Enhanced Flexibility: Scripts can source environment variables when needed
  4. Reduced Duplication: Eliminated redundant variable definitions
  5. Consistent Configuration: All scripts now use the same environment loading mechanism

Usage

To use the new environment variable system in your scripts:

#!/bin/bash
# Exit on error
set -e

# Source environment variables
source "$(dirname "$0")/env.sh"

# Your script logic here

Migration Notes

No migration steps are required for existing scripts. The changes are backward compatible, and all existing functionality continues to work as before.

Known Issues

None.

Future Improvements

  • Consider adding validation for required environment variables
  • Add support for environment-specific configuration files (e.g., .env.development, .env.production)
  • Implement a mechanism to override environment variables via command-line arguments