From a3c04e1c3623d9441d0478aa43a2ca1801107669 Mon Sep 17 00:00:00 2001 From: Netkas Date: Tue, 11 Jul 2023 22:25:53 -0400 Subject: [PATCH] Fixed issue #1 in Configuration->__construct() where the name of an environment variable was being used instead of its value when determining the configuration file path. This incorrect handling resulted in warnings about non-existent files and hindered the proper loading of configuration files. With this fix, environment variables should now correctly guide the path to the desired configuration files, improving the flexibility and functionality of the configuration library. --- CHANGELOG.md | 10 ++++++++++ src/ConfigLib/Configuration.php | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 677e61d..a89f4e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.2] - 2023-07-11 + +### Fixed + * Fixed issue [#1](https://git.n64.cc/nosial/libs/config/-/issues/1) in Configuration->__construct() where the name of + an environment variable was being used instead of its value when determining the configuration file path. This + incorrect handling resulted in warnings about non-existent files and hindered the proper loading of configuration + files. With this fix, environment variables should now correctly guide the path to the desired configuration files, + improving the flexibility and functionality of the configuration library. + + ## [1.0.1] - 2023-07-11 ### Changed diff --git a/src/ConfigLib/Configuration.php b/src/ConfigLib/Configuration.php index 3457b5e..3154347 100644 --- a/src/ConfigLib/Configuration.php +++ b/src/ConfigLib/Configuration.php @@ -55,10 +55,9 @@ $env = getenv(sprintf("CONFIGLIB_%s", strtoupper($name))); if($env !== false) { - $environment_config = sprintf('CONFIGLIB_%s', strtoupper($name)); - if(file_exists($environment_config)) + if(file_exists($env)) { - $this->path = $environment_config; + $this->path = $env; } else {