Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
targoninc-alex committed Oct 3, 2024
1 parent 5ddc27f commit 683a04f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/features/database/mariaDbDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export class MariaDbDatabase {
private pool: mariadb.Pool | null = null;

constructor(host: string | null = null, user: string | null = null, password: string | null = null, port: number | null = null) {
CLI.info(`Connecting to MariaDB at ${host}:${port} with user ${user} and database venel.`);
this.host = host || process.env.MYSQL_HOST || 'localhost';
this.port = port || 3306;
this.user = user || process.env.MYSQL_USER || 'root';
this.password = password || process.env.MYSQL_PASSWORD || '';
this.database = 'venel';
CLI.info(`Set up MariaDB connection to ${this.host}:${this.port} with user ${this.user} and database venel.`);
}

connect() {
Expand All @@ -43,6 +43,7 @@ export class MariaDbDatabase {
if (!this.pool) {
throw new Error("Could not connect to database.");
}
CLI.success(`DB connected.`);
}

async query(sql: string, params: unknown[] = []) {
Expand Down

0 comments on commit 683a04f

Please sign in to comment.