-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
Fix locally created database #56889
Fix locally created database #56889
Conversation
Move initialDatabases directive from the 'ensureUsers' scope to the correct outer 'mysql' one.
When database.createLocally is used, a mysql user is created with the ensureUsers directive. It ensures that the unix user with the name provided exists and can connect to MySQL through socket. Thus, the MySQL username used by php/perl scripts must match the unix user owning the server PID. This patch sets the default mysql to 'zoneminder' instead of 'zmuser'.
@@ -49,7 +49,7 @@ let | |||
# Database | |||
ZM_DB_TYPE=mysql | |||
ZM_DB_HOST=${cfg.database.host} | |||
ZM_DB_NAME=${cfg.database.name} | |||
ZM_DB_NAME=${if cfg.database.createLocally user else cfg.database.name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is syntax problem here - then
is missing. I guess this particular change wasn't tested somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, sorry about that. Will fix that asap, thanks for looking into it.
Fix syntax error and use the correct variable (cfg.database.username) when not creating the db locally.
PR messed up db and use naming NixOS#56889 while fixing the scope of the initialDatabases property. This patch fixes the issue.
PR NixOS#56889 messed up db and use naming while fixing the scope of the initialDatabases property. This patch fixes the issue.
@@ -49,7 +49,7 @@ let | |||
# Database | |||
ZM_DB_TYPE=mysql | |||
ZM_DB_HOST=${cfg.database.host} | |||
ZM_DB_NAME=${cfg.database.name} | |||
ZM_DB_NAME=${if cfg.database.createLocally then user else cfg.database.username} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Why would you want a different user when having zoneminder create the database?
Motivation for this change
In its current form the database.createLocally flag is broken. Those patches try to fix it.
Things done
Ping @peterhoeg
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)