#!/bin/bash

getConfigOptionData()
{
    local config_option="$1"
    local config_file="$2"

    # If no config file provided, auto-discover it
    if [[ -z "$config_file" ]]; then
        config_file=$(findConfigFileForOption "$config_option")
        if [[ $? -ne 0 || -z "$config_file" ]]; then
            echo ""
        fi
    fi

    # Extract the value (everything after =, before # comment)
    local value=$(grep "^$config_option=" "$config_file" | cut -d'=' -f2 | cut -d'#' -f1 | tr -d ' ')
    echo "$value"
}
