Change: Generalise Config class #339
Labels
No labels
bug
confirmed
critical
discussion
documentation
Doing
enhancement
experiment
suggestion
support
Testing
To Do
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: hazaar/framework#339
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
The
Hazaar\Application\Config
class is currently tightly coupled to application-specific configuration loading and management. Its naming and functionality limit its reuse in other components or libraries that could benefit from a general-purpose JSON-style configuration loader and handler.Who will benefit?
Benefits and risks
Benefits:
Risks:
Proposed solution
Class rename
Rename
Hazaar\Application\Config
toHazaar\Config
to reflect a broader scope of use.Support for base path
Add method
setBasePath(string $path)
that sets the root directory for resolving configuration files.Support configuration environments
Add support for enabling/disabling named environments (e.g.
production
,development
) that allow layered config loading.Configs will load base values first, and override them with environment-specific values from subdirectories or suffixed files.
Backward compatibility
The application can continue using the same logic by explicitly calling setBasePath('/path/to/app/config') when initializing the config.
Examples
New usage:
Application context:
Priority/Severity
assigned to @jamie
created branch
339-change-generalise-config-class
to address this issuementioned in merge request !227
mentioned in commit
6f7746e4a5