1

Is it possible to make a plugin for Magento\Setup\Model\ConfigOptionsList::validate()? This function checks the validity of connection to DB and since I am dynamically generating password for DB, I need to intercept the $options argument and pass my own password. I tried doing it the normal way:

<type name="Magento\Setup\Model\ConfigOptionsList">
        <plugin name="vendor_dynamic_password_plugin" sortOrder="1" type="Vendor\Module\Plugin\DynamicPasswordPlugin"/>
</type>

The plugin:

public function beforeValidate(ConfigOptionsList $subject, array $options, DeploymentConfig $deploymentConfig)
    {
        dd('it works!');
        return [$options, $deploymentConfig];
    }

But unfortunately this doesn't work. This will not even generate the interceptor. I know I could use the --skip-db-validation argument, but I don't want to bypass the internal DB validation. Thank you

1 Answer 1

0

You can pass the custom password using --db-password param.

Reference: https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/advanced.html?lang=en

1
  • Thank you, but this is not what I want to do. The DB password is dynamically generated by a custom module in M2, I just need to pass it to the options argument in the validate function.
    – InToSSH
    Commented Jul 23, 2023 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.