From 26df3b2287acca225a1142b27c571252c75e37bd Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Tue, 12 Aug 2025 13:18:04 +0000
Subject: [PATCH] adding prod

---
 lib/db.js                        |    3 ++-
 settings.prod.json               |   18 ++++++++++++++++++
 APACHE-config/apache-config.conf |    6 ++++++
 rsyncToHati                      |    1 +
 bin/users.js                     |   23 +++++++++++++++++++++++
 5 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/APACHE-config/apache-config.conf b/APACHE-config/apache-config.conf
new file mode 100644
index 0000000..463f31c
--- /dev/null
+++ b/APACHE-config/apache-config.conf
@@ -0,0 +1,6 @@
+# in Apache Config einfügen
+
+    # proxy all requests to /popcorn/... to the globus-ilias-rest service # alex@minervis.com
+    ProxyPreserveHost On
+    ProxyPass /popcorn http://localhost:4101
+    ProxyPassReverse /popcorn http://localhost:4101
diff --git a/bin/users.js b/bin/users.js
new file mode 100644
index 0000000..5a89c4e
--- /dev/null
+++ b/bin/users.js
@@ -0,0 +1,23 @@
+const iliasLib = require("../lib/libIlias")
+const db = require("../lib/db")
+const yargs = require("yargs")
+
+/////////////////////////////////////////////////////////////////////////
+
+const argv = yargs
+   .usage("$0 [offset] [limit]", "get users from ILIAS",)
+   .strict()
+   .parse()
+
+
+run(argv)
+   .then(console.log)
+   .catch(console.error)
+   .finally(process.exit)
+
+async function run({offset, limit}) {
+   offset = offset || 0
+   limit = limit || 3
+   return await db.getUsers(offset, limit)
+}
+
diff --git a/lib/db.js b/lib/db.js
index a2ed632..96dfa0e 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -90,8 +90,9 @@
 
    try {
       let userSearchQuery = await getUserSearchQuery(offset, limit, search)
-      // log.info(userSearchQuery)
+      log.info(userSearchQuery)
       const [results, fields] = await pool.query(userSearchQuery)
+      console.log(results, fields)
       const count = await getUserCount(offset, limit, search)
       return {
          total: count,
diff --git a/rsyncToHati b/rsyncToHati
new file mode 100755
index 0000000..0d069ea
--- /dev/null
+++ b/rsyncToHati
@@ -0,0 +1 @@
+rsync -ar . hati:globus-ilias-rest/
diff --git a/settings.prod.json b/settings.prod.json
new file mode 100644
index 0000000..03fa6cb
--- /dev/null
+++ b/settings.prod.json
@@ -0,0 +1,18 @@
+{
+   "authtoken": "jiuGfr432898D90290kj4f45ldkfn3hh8F",
+   "port": 4101,
+   "db": {
+      "host": "neso.ms.minervis.com",
+      "port": 3306,
+      "database": "ilias_globus",
+      "user": "globusadmin",
+      "password": "yyJkbd2XEN8nvrp59X8A"
+   },
+   "ilias": {
+      "urlDoc": "Url of custom ILIAS PHP file",
+      "url": "https://www.lernen-mit-globus-baumarkt.de/globus-ilias-rest/login.php",
+      "iliastoken": "jkhHKhui899HUKHBzGHtgoiedko2393490",
+      "iliasTokenComment": "Token muss bei Änderungen nach php/globus-ilias-rest/token kopiert werden",
+      "exampleUrlPhp": "https://www.lernen-mit-globus-baumarkt.de/globus-ilias-rest/login.php?token=jkhHKhui899HUKHBzGHtgoiedko2393490&command=ping"
+   }
+}

--
Gitblit v1.8.0