phiilu / mailman

Mailman is a GUI to help you manage your email accounts stored in a MySQL/MariaDB database.
MIT License
70 stars 10 forks source link

Support of unix socket for access to mysql/mariadb database #41

Open casswarry0 opened 4 years ago

casswarry0 commented 4 years ago

To support unix sockets for database access I had to change the file: /opt/mailman/build/main.js

where it was: const db = __WEBPACK_IMPORTED_MODULE_0_knex___default()({ client: process.env.MAILMAN_DB_ENGINE || "maria", connection: { host: process.env.MAILMAN_DB_HOST || "127.0.0.1", user: process.env.MAILMAN_DB_USER, password: process.env.MAILMAN_DB_PASSWORD, db: process.env.MAILMAN_DB_DATABASE } });

I made: const db = __WEBPACK_IMPORTED_MODULE_0_knex___default()({ client: process.env.MAILMAN_DB_ENGINE || "maria", connection: { unixSocket: process.env.MAILMAN_DB_SOCKET, host: process.env.MAILMAN_DB_HOST, user: process.env.MAILMAN_DB_USER, password: process.env.MAILMAN_DB_PASSWORD, db: process.env.MAILMAN_DB_DATABASE } });

I added the unixSocket and removed the default from host. It would be nice to add port too, for issue #38. After the change, there has to be either MAILMAN_DB_SOCKET or MAILMAN_DB_HOST in the .env file but not both.