Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: set hosts before database setup

Abdullah Atta0ea3b3ac2ae4
diff --git a/apps/web/src/common/db.ts b/apps/web/src/common/db.ts
index 930beb842..990ce51d6 100644
--- a/apps/web/src/common/db.ts
+++ b/apps/web/src/common/db.ts
@@ -33,14 +33,6 @@ async function initializeDatabase(persistence: DatabasePersistence) {
const { Compressor } = await import("../utils/compressor");
db = database;
- database.setup(
- new NNStorage("Notesnook", persistence),
- EventSource,
- FS,
- new Compressor()
- );
-
- // if (isTesting()) {
db.host({
API_HOST: "https://api.notesnook.com",
AUTH_HOST: "https://auth.streetwriters.co",
@@ -48,6 +40,15 @@ async function initializeDatabase(persistence: DatabasePersistence) {
ISSUES_HOST: "https://issues.streetwriters.co",
SUBSCRIPTIONS_HOST: "https://subscriptions.streetwriters.co"
});
+
+ database.setup(
+ new NNStorage("Notesnook", persistence),
+ EventSource,
+ FS,
+ new Compressor()
+ );
+ // if (isTesting()) {
+
// } else {
// db.host({
// API_HOST: "http://localhost:5264",
@@ -64,7 +65,6 @@ async function initializeDatabase(persistence: DatabasePersistence) {
// });
// }
-
await db.init();
logger.measure("Database initialization");