Patchwork services: mysql: Add port to configuration

login
register
mail settings
Submitter Christopher Baines
Date Dec. 11, 2016, 9:17 p.m.
Message ID <20161211211740.30281-1-mail@cbaines.net>
Download mbox | patch
Permalink /patch/18377/
State New
Headers show

Comments

Christopher Baines - Dec. 11, 2016, 9:17 p.m.
* gnu/services/databases.scm (<mysql-configuration>): Add port field.
  (mysql-configuration-file): Use the port field when creating the
  configuration file.
---
 gnu/services/databases.scm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Ludovic Courtès - Dec. 13, 2016, 10:55 p.m.
Christopher Baines <mail@cbaines.net> skribis:

> * gnu/services/databases.scm (<mysql-configuration>): Add port field.
>   (mysql-configuration-file): Use the port field when creating the
>   configuration file.

I added a guix.texi item and committed.  Thanks!

Ludo’.

Patch

diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index 1eed85542..f7e08e696 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -160,7 +160,8 @@  and stores the database cluster in @var{data-directory}."
 (define-record-type* <mysql-configuration>
   mysql-configuration make-mysql-configuration
   mysql-configuration?
-  (mysql mysql-configuration-mysql (default mariadb)))
+  (mysql mysql-configuration-mysql (default mariadb))
+  (port mysql-configuration-port (default 3306)))
 
 (define %mysql-accounts
   (list (user-group
@@ -175,10 +176,11 @@  and stores the database cluster in @var{data-directory}."
 
 (define mysql-configuration-file
   (match-lambda
-    (($ <mysql-configuration> mysql)
-     (plain-file "my.cnf" "[mysqld]
+    (($ <mysql-configuration> mysql port)
+     (mixed-text-file "my.cnf" "[mysqld]
 datadir=/var/lib/mysql
 socket=/run/mysqld/mysqld.sock
+port=" (number->string port) "
 "))))
 
 (define (%mysql-activation config)