Skip to content

[6.0] Variables from non natural environment #45523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 54 commits into
base: 6.0-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
5e6d124
add phpdotenv
Fedik Mar 9, 2025
ea925de
add phpdotenv
Fedik Mar 9, 2025
1b4ffb4
add phpdotenv
Fedik Mar 9, 2025
e0b71da
add phpdotenv
Fedik Mar 9, 2025
404f504
add phpdotenv
Fedik Mar 9, 2025
8ad59b0
Merge branch '6.0-dev' into env-phpdotenv
Fedik May 15, 2025
b0887b8
conflict fix
Fedik May 15, 2025
d3c4b19
update
Fedik May 15, 2025
e41275c
update
Fedik May 15, 2025
aa3b167
update map
Fedik May 15, 2025
6da3ac3
update map
Fedik May 15, 2025
7fc72b8
update map
Fedik May 15, 2025
f64878d
update map
Fedik May 15, 2025
08bd576
update map
Fedik May 15, 2025
e6939f8
comment
Fedik May 15, 2025
3f8e688
installer env
Fedik May 17, 2025
87b8d9f
installer env
Fedik May 17, 2025
66bdfba
installer env
Fedik May 17, 2025
6ae2cb7
installer env
Fedik May 17, 2025
4055f07
installer env
Fedik May 17, 2025
1d23192
installer env
Fedik May 17, 2025
1edbb3b
installer env
Fedik May 17, 2025
39ae908
installer env
Fedik May 17, 2025
4a56942
installer env
Fedik May 17, 2025
ddf39b0
installer env
Fedik May 18, 2025
3f4fc7c
installer env
Fedik May 18, 2025
f14feff
installer env
Fedik May 18, 2025
1717e85
installer env cli
Fedik May 18, 2025
8b7a0d8
installer env
Fedik May 18, 2025
ce36cf3
installer env
Fedik May 18, 2025
08ede5f
installer env
Fedik May 18, 2025
39e3ea7
installer env
Fedik May 18, 2025
55825aa
installer env
Fedik May 18, 2025
c487d5b
installer env
Fedik May 18, 2025
d46b7f0
installer env
Fedik May 18, 2025
289cf18
installer env
Fedik May 18, 2025
e043d77
str
Fedik May 18, 2025
946f9a0
str
Fedik May 18, 2025
4c2debf
install
Fedik May 18, 2025
c994c5d
readonly config
Fedik May 19, 2025
0d5478b
cli config validation
Fedik May 24, 2025
2fe92e4
config
Fedik May 24, 2025
ed9ce82
cs
Fedik May 24, 2025
f9849a3
cs
Fedik May 24, 2025
55e0547
cs
Fedik May 24, 2025
91767d1
Merge branch '6.0-dev' into env-phpdotenv
Fedik May 24, 2025
3112302
cs
Fedik May 24, 2025
e117017
Merge branch '6.0-dev' into env-phpdotenv
Fedik May 31, 2025
2b5e153
Check for empty env and use short "dev"
Fedik May 31, 2025
1306121
cs
Fedik May 31, 2025
5ae847d
upd
Fedik Jun 3, 2025
730b45a
upd
Fedik Jun 3, 2025
c77353c
Merge branch '6.0-dev' into env-phpdotenv
Fedik Jun 7, 2025
21505ef
upd
Fedik Jun 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
/web.config
/.php-cs-fixer.cache
/media
.env
.env.*

# Template CSS files generated by NPM
/installation/template/css
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ public function getForm($data = [], $loadData = true)
return false;
}

// Check for parameters provided by $_ENV
$envMap = Factory::getContainer()->get('config.env-map');
$usedEnvs = array_intersect_key($envMap, $_ENV);

foreach ($usedEnvs as $fieldName) {
$form->setFieldAttribute($fieldName, 'readonly', 'true');
$form->setFieldAttribute($fieldName, 'required', 'false');
}

return $form;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ public function display($tpl = null)
// Bind data
if ($this->form && $this->data) {
$this->form->bind($this->data);

// Check for parameters provided by $_ENV
$fromEnv = [];
$envMap = Factory::getContainer()->get('config.env-map');
$usedEnvs = array_intersect_key($envMap, $_ENV);

foreach ($usedEnvs as $fieldName) {
$fromEnv[] = Text::_($this->form->getFieldAttribute($fieldName, 'label'));
}

if ($fromEnv) {
Factory::getApplication()
->enqueueMessage(Text::sprintf('COM_CONFIG_FIELDS_FROM_ENV', implode(', ', $fromEnv)));
}
}

// Get the params for com_users.
Expand Down
6 changes: 3 additions & 3 deletions administrator/includes/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$config = new JConfig();

// Set the error_reporting, and adjust a global Error Handler
switch ($config->error_reporting) {
switch ($_ENV['JOOMLA_ERROR_REPORTING'] ?? $config->error_reporting) {
case 'default':
case '-1':
break;
Expand All @@ -71,13 +71,13 @@
break;

default:
error_reporting($config->error_reporting);
error_reporting($_ENV['JOOMLA_ERROR_REPORTING'] ?? $config->error_reporting);
ini_set('display_errors', 1);

break;
}

\define('JDEBUG', $config->debug);
\define('JDEBUG', (($_ENV['JOOMLA_DEBUG'] ?? '') === 'true' || $config->debug));

// Check deprecation logging
if (empty($config->log_deprecated)) {
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/com_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ COM_CONFIG_FIELD_WEBSERVICES_CORS_OFF_LABEL="Enable CORS"
COM_CONFIG_FIELD_WEBSERVICES_CORS_ALLOW_HEADERS_DESC="Specifies the header(s) sent back in response to a preflight request. Default: Content-Type,X-Joomla-Token"
COM_CONFIG_FIELD_WEBSERVICES_CORS_ALLOW_METHODS_DESC="Specifies the Web service method(s) allowed to access on this site, sent back in response to a preflight request. Default: all methods available for the requested route."
COM_CONFIG_FIELD_WEBSERVICES_CORS_ALLOW_ORIGIN_DESC="Specifies the origin allowed to access Web services on this site, sent back in response to a preflight request. Default: * (=all)."
COM_CONFIG_FIELDS_FROM_ENV="The following parameters are provided by environment variables: <strong>%s</strong>. And therefore cannot be changed."
COM_CONFIG_FIELDSET_TAGS_LABEL="Tags"
COM_CONFIG_FILTER_OPTION_SELECT_EXTENSION="- Select Extension -"
COM_CONFIG_FRONTEDITING_DESC="Joomla can show an overlay in the public front–end, visible only to users with edit privileges, to directly modify the configuration of each module and/or menu displayed on the site. Set to \"None\" to disable this feature."
Expand Down
6 changes: 3 additions & 3 deletions api/includes/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$config = new JConfig();

// Set the error_reporting
switch ($config->error_reporting) {
switch ($_ENV['JOOMLA_ERROR_REPORTING'] ?? $config->error_reporting) {
case 'default':
case '-1':
break;
Expand All @@ -71,13 +71,13 @@
break;

default:
error_reporting($config->error_reporting);
error_reporting($_ENV['JOOMLA_ERROR_REPORTING'] ?? $config->error_reporting);
ini_set('display_errors', 1);

break;
}

\define('JDEBUG', $config->debug);
\define('JDEBUG', (($_ENV['JOOMLA_DEBUG'] ?? '') === 'true' || $config->debug));

// Check deprecation logging
if (empty($config->log_deprecated)) {
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
"phpseclib/bcmath_compat": "^2.0.3",
"jfcherng/php-diff": "^6.16.2",
"php-tuf/php-tuf": "^1.0.3",
"php-debugbar/php-debugbar": "^2.1.6"
"php-debugbar/php-debugbar": "^2.1.6",
"vlucas/phpdotenv": "^5.6"
},
"require-dev": {
"phpunit/phpunit": "^9.6.22",
Expand Down
223 changes: 222 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions includes/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
$config = new JConfig();

// Set the error_reporting, and adjust a global Error Handler
switch ($config->error_reporting) {
switch ($_ENV['JOOMLA_ERROR_REPORTING'] ?? $config->error_reporting) {
case 'default':
case '-1':
break;
Expand All @@ -72,14 +72,14 @@
break;

default:
error_reporting($config->error_reporting);
error_reporting($_ENV['JOOMLA_ERROR_REPORTING'] ?? $config->error_reporting);
ini_set('display_errors', 1);

break;
}

if (!\defined('JDEBUG')) {
\define('JDEBUG', $config->debug);
\define('JDEBUG', (($_ENV['JOOMLA_DEBUG'] ?? '') === 'true' || $config->debug));
}

// Check deprecation logging
Expand Down
Loading