ObjectivePHP RFC: Parameter config directive
Summary
An app’s config is everything that is likely to vary between deploys (staging, production, developer environments, etc). I suggest, according to 12 factors app, a strict separation of config from code. Config varies substantially across deploys, code does not.
Currently we are able to override the config with a .local.php file. That's a way we can keep.
I suggest to add a feature to the config component, to reach the environment variables.
Proposal
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in RFC 2119.
Using a Environment Directive with default value :
<?php
return [
new EnvironmentDirective('APP_MODE', 'development');
];
Using an optional Environment Directive :
<?php
return [
(new EnvironmentDirective('database.host'))->setOptional();
];
$config->get('database.host') instanceof UndefinedDirective; // true if no key `database.host` is not found in the environment
We also need to add another loader ObjectivePHP\Config\Loader\DotenvLoader. It will use vlucas/phpdotenv.
Backward Incompatible Changes
It will not include Incompatible Changes, it's a MINOR enhancement
Proposed ObjectivePHP Version(s)
objective-php/config 1.1.0
RFC Impact
To Components
NO
To Packages
NO
To Workflow
NO
To Configuration
It add this new way to manage changes between environments.
Future Scope
Future scope can be the extension of this directive with SecretParameterDirective that store encrypted value of the parameter.
Proposed Voting Choices
50%+1 majority
Links to external references, discussions, issues or RFCs
ObjectivePHP RFC: Parameter config directive
Summary
An app’s config is everything that is likely to vary between deploys (staging, production, developer environments, etc). I suggest, according to 12 factors app, a strict separation of config from code. Config varies substantially across deploys, code does not.
Currently we are able to override the config with a
.local.phpfile. That's a way we can keep.I suggest to add a feature to the config component, to reach the environment variables.
Proposal
Using a Environment Directive with default value :
Using an optional Environment Directive :
We also need to add another loader
ObjectivePHP\Config\Loader\DotenvLoader. It will usevlucas/phpdotenv.Backward Incompatible Changes
It will not include Incompatible Changes, it's a MINOR enhancement
Proposed ObjectivePHP Version(s)
objective-php/config 1.1.0
RFC Impact
To Components
NO
To Packages
NO
To Workflow
NO
To Configuration
It add this new way to manage changes between environments.
Future Scope
Future scope can be the extension of this directive with
SecretParameterDirectivethat store encrypted value of the parameter.Proposed Voting Choices
50%+1 majority
Links to external references, discussions, issues or RFCs