From 0527f3b1fe047b0fa0bc5e54e2fc4610e6363c29 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Thu, 1 Feb 2024 13:01:26 -0500 Subject: [PATCH] wip --- NOTES | 15 +++++++++++++++ package.json | 1 + src/fetchCollection.js | 3 ++- src/routes/+page.server.js | 3 ++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/NOTES b/NOTES index c5729c2..dd666d0 100644 --- a/NOTES +++ b/NOTES @@ -7,4 +7,19 @@ The root path for all requests in the XMLAPI2 are prefixed as follows. These que https://rpggeek.com/xmlapi2/ https://videogamegeek.com/xmlapi2/ +## Ansible stuff +create user bggsell +install fnm, nvm for it? +touch ~/.profile +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash +nvm install v21.6.1 +npm install -g pnpm +npm run vite build +nginx configuration + +.profile => add DATABASE_URL + +// DONE: add apache redirection + +PORT=8097 node build/index.js diff --git a/package.json b/package.json index ceeb6d8..da5759a 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ }, "type": "module", "dependencies": { + "@sveltejs/adapter-node": "^4.0.1", "@vincjo/datatables": "^1.14.4", "beercss": "^3.4.13", "better-sqlite3": "^9.3.0", diff --git a/src/fetchCollection.js b/src/fetchCollection.js index 7a870a2..10558f0 100644 --- a/src/fetchCollection.js +++ b/src/fetchCollection.js @@ -2,7 +2,8 @@ import { load } from 'cheerio'; import fetch from 'node-fetch'; import DB from 'better-sqlite3'; -const db = DB('games.db'); +const db_file = process.env.DATABASE_URL.replace('sqlite3:',''); +const db = DB(db_file); db.pragma('journal_mode = WAL'); export async function fetch_guild_users (guild_id) { diff --git a/src/routes/+page.server.js b/src/routes/+page.server.js index 9a6beb3..04e3583 100644 --- a/src/routes/+page.server.js +++ b/src/routes/+page.server.js @@ -1,8 +1,9 @@ import DB from 'better-sqlite3'; +const db_file = process.env.DATABASE_URL.replace('sqlite3:',''); export async function load() { - const db = DB('games.db'); + const db = DB(db_file); db.pragma('journal_mode = WAL'); return {