summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-09-02 01:01:58 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-09-02 01:01:58 +1000
commited7fd34f46ffd1322f7d0e6ea81e4612afb0ec4a (patch)
treee60be79c0bf5fa9d5ee945a408319ac534d7d014
parentMerge branch 'master' of github.com:spacebarchat/server (diff)
downloadserver-ed7fd34f46ffd1322f7d0e6ea81e4612afb0ec4a.tar.xz
DB_LOGGING env var
-rw-r--r--src/util/util/Database.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/util/util/Database.ts b/src/util/util/Database.ts
index a6b24b3e..3a45eea0 100644
--- a/src/util/util/Database.ts
+++ b/src/util/util/Database.ts
@@ -16,12 +16,12 @@
 	along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-import { DataSource } from "typeorm";
-import { yellow, green, red } from "picocolors";
-import { Migration } from "../entities/Migration";
-import { ConfigEntity } from "../entities/Config";
 import { config } from "dotenv";
 import path from "path";
+import { green, red, yellow } from "picocolors";
+import { DataSource } from "typeorm";
+import { ConfigEntity } from "../entities/Config";
+import { Migration } from "../entities/Migration";
 
 // UUID extension option is only supported with postgres
 // We want to generate all id's with Snowflakes that's why we have our own BaseEntity class
@@ -50,7 +50,7 @@ const DataSourceOptions = new DataSource({
 	database: isSqlite ? dbConnectionString : undefined,
 	entities: [path.join(__dirname, "..", "entities", "*.js")],
 	synchronize: !!process.env.DB_SYNC,
-	logging: false,
+	logging: !!process.env.DB_LOGGING,
 	bigNumberStrings: false,
 	supportBigNumbers: true,
 	name: "default",
@@ -129,7 +129,7 @@ export async function initDatabase(): Promise<DataSource> {
 	return dbConnection;
 }
 
-export { dbConnection, DataSourceOptions, DatabaseType };
+export { DataSourceOptions, DatabaseType, dbConnection };
 
 export async function closeDatabase() {
 	await dbConnection?.destroy();