services: mysql: Add extra-environment as configuration option.
authormethuselah-0 <david.larsson@selfhosted.xyz>
Sun, 11 Apr 2021 08:30:01 +0000 (10:30 +0200)
committerLeo Prikler <leo.prikler@student.tugraz.at>
Tue, 13 Apr 2021 16:47:32 +0000 (18:47 +0200)
* gnu/services/databases.scm (mysql-configuration): Add extra-environment
(mysql-service): Use #:log-file and #:environment-variables
* doc/guix.texi: Document it.

Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at>
doc/guix.texi
gnu/services/databases.scm

index 1069a5d..fa14b35 100644 (file)
@@ -19947,6 +19947,9 @@ Socket file to use for local (non-network) connections.
 @item @code{extra-content} (default: @code{""})
 Additional settings for the @file{my.cnf} configuration file.
 
+@item @code{extra-environment} (default: @code{#~'()})
+List of environment variables passed to the @command{mysqld} process.
+
 @item @code{auto-upgrade?} (default: @code{#t})
 Whether to automatically run @command{mysql_upgrade} after starting the
 service.  This is necessary to upgrade the @dfn{system schema} after
index 6ef3f33..956993d 100644 (file)
@@ -7,6 +7,7 @@
 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -527,6 +528,7 @@ created after the PostgreSQL database is started.")))
   (port mysql-configuration-port (default 3306))
   (socket mysql-configuration-socket (default "/run/mysqld/mysqld.sock"))
   (extra-content mysql-configuration-extra-content (default ""))
+  (extra-environment mysql-configuration-extra-environment (default #~'()))
   (auto-upgrade? mysql-configuration-auto-upgrade? (default #t)))
 
 (define %mysql-accounts
@@ -611,11 +613,14 @@ FLUSH PRIVILEGES;
          (provision '(mysql))
          (documentation "Run the MySQL server.")
          (start (let ((mysql  (mysql-configuration-mysql config))
+                      (extra-env (mysql-configuration-extra-environment config))
                       (my.cnf (mysql-configuration-file config)))
                   #~(make-forkexec-constructor
                      (list (string-append #$mysql "/bin/mysqld")
                            (string-append "--defaults-file=" #$my.cnf))
-                     #:user "mysql" #:group "mysql")))
+                           #:user "mysql" #:group "mysql"
+                           #:log-file "/var/log/mysqld.log"
+                           #:environment-variables #$extra-env)))
          (stop #~(make-kill-destructor)))))
 
 (define (mysql-upgrade-wrapper mysql socket-file)