in2code-de / powermailrecaptcha

Google recaptcha for powermail 3
10 stars 13 forks source link

Environment variables #22

Open pduersteler opened 2 years ago

pduersteler commented 2 years ago

Hi

While implementing this extension into a project, we found that the current way of handling the configurations could be improved.

Right now, the defaults are in ext_typoscript_constants.txt and ext_typoscript_setup.txt (for which I could not find any documentation btw, are these following any core convention?). The problem with the current loading of configuration is that the loading order can't be affected in any way as the extension configuration itself is always loaded "at the end"; One can't override the settings in a custom project-specific extension's configuration that is being loaded through \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(). It only works so far if we put the configuration directly into a db-based sys_template record.

Additionally, as credentials should not be in a VCS anyway, we thought that we might be able to load the configuration via .env, as the API keys might be environment-specific. This would allow changing them without touching the database.

Maybe a nice improvement step would be to actually use ext_emconf_template.txt / get the configuration from the EXTENSIONS array from e. g. LocalConfiguration.php / AdditionalConfiguration.php which then would allow to set the API keys via .env, and it would also allow to override configuration in a project extension as described above, without it ignoring the desired loading order.

What do you think?

instruccionesaldorso commented 1 year ago

I had the same issue, @pduersteler . I just sent a pull request to solve it, besides a few topics related to TSconfig and partial.

sbusemann commented 1 month ago

https://projekte.in2code.de/issues/64174