Skip to content
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

[FEATURE] Allow storage configuration override in config/system/addit… #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cweiske
Copy link
Contributor

@cweiske cweiske commented Jan 5, 2024

…ional.php

Record-based storage configuration can be overridden by defining
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['aus_driver_amazon_s3']['storage']
or
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['aus_driver_amazon_s3']['storage_X']
(where X is the UID of the storage record)
in config/system/additional.php.

This makes it possible to use environment variable based storage configuration, and no secret keys need to be stored in the database anymore.

Storage configuration in the database record is merged with the generic 'storage' configuration, which then with the uid-specific storage config.

Example for defining the credentials in config/system/additional.php:

$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['aus_driver_amazon_s3']['storage_23'] = [
    'key'       => $_ENV['S3_KEY'],
    'secretKey' => $_ENV['S3_SECRET'],
];

@@ -218,7 +218,8 @@ public function processConfiguration()
*/
public function initialize()
{
$this->initializeBaseUrl()
$this->loadSettings()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think if we don't create new "loadSettings" function? We just apply code the inside the "initializeSettings", move "initializeSettings()" to the top of "initializeBaseUrl()".

$this->initializeSettings()
     ->initializeBaseUrl()
     ->initializeClient();

…ional.php

Record-based storage configuration can be overridden by defining
  $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['aus_driver_amazon_s3']['storage']
or
  $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['aus_driver_amazon_s3']['storage_X']
(where X is the UID of the storage record)
in config/system/additional.php.

This makes it possible to use environment variable based storage configuration,
and no secret keys need to be stored in the database anymore.

Storage configuration in the database record is merged with the generic
'storage' configuration, which then with the uid-specific storage config.

Example for defining the credentials in config/system/additional.php:

$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['aus_driver_amazon_s3']['storage_23'] = [
    'key'       => $_ENV['S3_KEY'],
    'secretKey' => $_ENV['S3_SECRET'],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants