π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Fix db connection options
Smaug6739c8a1c20ddcbf
diff --git a/backend/App.ts b/backend/App.tsindex 2203ec65..38e3d066 100644--- a/backend/App.ts+++ b/backend/App.ts@@ -25,7 +25,13 @@ export class App {this.app = express();this.port = process.env.PORT || '3000';this.snowflake = new Snowflake(1661327668261);- this.db = db('127.0.0.1', process.env.DATABASE_USER, process.env.DATABASE_PASSWORD, 'alexandrie');+ this.db = db(+ process.env.DB_HOST,+ process.env.DB_USER,+ process.env.DB_PASSWORD,+ process.env.DB_NAME,+ parseInt(process.env.DB_PORT || '3306'),+ );}private async handleRoutes() {const directories = readdirSync(join(__dirname, 'routes'));diff --git a/backend/models/db.ts b/backend/models/db.tsindex c59bff8a..26e9e5f5 100644--- a/backend/models/db.ts+++ b/backend/models/db.ts@@ -1,11 +1,12 @@import { createPool } from 'mysql2';-function getConnection(host?: string, user?: string, password?: string, db_name?: string) {+function getConnection(host?: string, user?: string, password?: string, db_name?: string, port?: number) {return createPool({host: host,user: user,password: password,database: db_name,+ port: port,});}diff --git a/database/alexandrie.sql b/database/alexandrie.sqlindex 4c16de99..713f2670 100644--- a/database/alexandrie.sql+++ b/database/alexandrie.sql@@ -1,8 +1,8 @@--- MySQL dump 10.13 Distrib 8.0.37, for Linux (x86_64)+-- MySQL dump 10.13 Distrib 8.0.39, for Linux (x86_64)---- Host: 127.0.0.1 Database: alexandrie-- --------------------------------------------------------- Server version 8.0.37-0ubuntu0.24.04.1+-- Server version 8.0.39-0ubuntu0.24.04.1/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;@@ -219,11 +219,11 @@ CREATE TABLE `users` (`username` varchar(25) NOT NULL,`firstname` varchar(25) DEFAULT NULL,`lastname` varchar(25) DEFAULT NULL,- `role` int default 1 NOT NULL,+ `role` int NOT NULL DEFAULT '1' COMMENT '1 = user; 2 = admin',`avatar` varchar(75) DEFAULT NULL,`email` varchar(50) NOT NULL,- `password` varchar(255) NOT NULL,`created_timestamp` bigint NOT NULL,+ `password` varchar(255) NOT NULL,`updated_timestamp` bigint NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;@@ -238,4 +238,4 @@ CREATE TABLE `users` (/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;--- Dump completed on 2024-07-29 13:28:38+-- Dump completed on 2024-08-11 10:57:24