@oravecz opened this Issue on February 28th 2020

I have database configuration stored in an external system. In bootstrap.php I fetch the credentials. How do I pass them, or set a variable, so the matomo database connections use this config data?

@oravecz commented on February 28th 2020

I found a plugin that does something like this. It looks like I need to override the settings read from the config.ini.php file, and there is an event that triggers which will allow me to do this.

From the plugin, I see how I can register for the Db.getDatabaseConfig event. I don't think I want to create a plugin in the bootstrap.php file. Is there an easier way to tap into that event registration in the bootstrap.php file?

@tsteur commented on February 29th 2020 Member

@oravecz you will want to install this plugin https://plugins.matomo.org/EnvironmentVariables and then configure it like this

putenv("MATOMO_DATABASE_HOST=...");
putenv("MATOMO_DATABASE_PASSWORD=...");

Haven't tested it but likely works.

@oravecz commented on February 29th 2020

So, no way to listen for that event via some code I initialize in bootstrap.php?

Maybe the EventDispatcher.addObserver() function?

I am trying to stay away from plugins because I am deploying this fully configured. Can’t use the admin console to install plugins dynamically. I know I can install the plugin locally by unzipping into a folder, but I’m trying to keep it simple.

—PHP noob here—

@tsteur commented on February 29th 2020 Member

@oravecz I can't think of another way unfortunately.

This Issue was closed on February 29th 2020
Powered by GitHub Issue Mirror