Closed bbodenmiller closed 5 years ago
Not sure if other users would always want this behaviour that we automatically connect to that DB? I don't know pivotal.io ... maybe users would want to also connect to other DB not sure? I would say feel free to issue a PR and we can merge it but the problem is, that we'd need to support it then and we wouldn't even be able to test it. I recommend you create your own plugin and ideally put it on our marketplace so other users can benefit from it as well. We have guides for this here: https://developer.matomo.org/develop
Basically, you only need to slightly adjust the logic when reading environment variables here: https://github.com/matomo-org/plugin-EnvironmentVariables/blob/master/config/config.php#L21
And make sure the plugin class has a method isTrackerPlugin()
returning true see https://github.com/matomo-org/plugin-EnvironmentVariables/blob/master/EnvironmentVariables.php#L13-L16
When you create a MySQL database on PCF it returns the connection details via
VCAP_SERVICES
environment variable. Would be nice if this extension knew how to read that so as to prevent users from having to create less-secure service keys to get login details to pass via separate environment variable.https://docs.pivotal.io/p-mysql/2-4/reference.html
If plugin could connect/parse database URI, that can be gotten from simple env variable
DATABASE_URL
.