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

Variables from .env ignored in SQL scripts because of hardcoded values #83

Open
holger-stenzhorn opened this issue Jan 9, 2025 · 0 comments

Comments

@holger-stenzhorn
Copy link

In rdc/redcap-overrides/mysql/scripts/20_mysql8_permission_update.sql and rdc/redcap-overrides/mysql/scripts/30_update_timezone.sql values are hardcoded instead of using the respective variables defined in .env, i.e. MYSQL_ROOT_PASSWORD, MYSQL_PASSWORD and TZ.

If e.g. the variable MYSQL_PASSWORD is set in .env to a non-default value then this breaks /opt/redcap/rdc/redcap-overrides/web/webroot/REDCapInstaller.php.

20_mysql8_permission_update.sql

ALTER USER 'redcap'@'%' IDENTIFIED WITH mysql_native_password BY 'redcap123';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';

30_update_timezone.sql

SET GLOBAL time_zone = 'America/Los_Angeles';

REDCapInstaller.php

public function __construct() {
        ...
        $this->password = empty($_ENV['MYSQL_PASSWORD']) ? FALSE : $_ENV['MYSQL_PASSWORD'];
        ...
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

No branches or pull requests

1 participant