need separate settings file
3 files added
5 files modified
| | |
| | | const fastify = require('fastify')({ |
| | | logger: true |
| | | }) |
| | | const _ = require("lodash") |
| | | const db = require("./lib/db") |
| | | |
| | | const settings = require("./settings") |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | |
| | | { |
| | | "name": "globus-ilias-rest", |
| | | "version": "0.1", |
| | | "lockfileVersion": 3, |
| | | "requires": true, |
| | | "packages": { |
| | | "": { |
| | | "name": "globus-ilias-rest", |
| | | "version": "0.1", |
| | | "dependencies": { |
| | | "fastify": "^5.3.3", |
| | | "lodash": "^4.17.21", |
| | | "mysql2": "^3.14.1", |
| | | "nconf": "^0.13.0", |
| | | "nodemon": "^3.1.10" |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "node_modules/ansi-regex": { |
| | | "version": "5.0.1", |
| | | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", |
| | | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", |
| | | "license": "MIT", |
| | | "engines": { |
| | | "node": ">=8" |
| | | } |
| | | }, |
| | | "node_modules/ansi-styles": { |
| | | "version": "4.3.0", |
| | | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", |
| | | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", |
| | | "license": "MIT", |
| | | "dependencies": { |
| | | "color-convert": "^2.0.1" |
| | | }, |
| | | "engines": { |
| | | "node": ">=8" |
| | | }, |
| | | "funding": { |
| | | "url": "https://github.com/chalk/ansi-styles?sponsor=1" |
| | | } |
| | | }, |
| | | "node_modules/anymatch": { |
| | | "version": "3.1.3", |
| | | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", |
| | |
| | | "engines": { |
| | | "node": ">= 8" |
| | | } |
| | | }, |
| | | "node_modules/async": { |
| | | "version": "3.2.6", |
| | | "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", |
| | | "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", |
| | | "license": "MIT" |
| | | }, |
| | | "node_modules/atomic-sleep": { |
| | | "version": "1.0.0", |
| | |
| | | "fsevents": "~2.3.2" |
| | | } |
| | | }, |
| | | "node_modules/cliui": { |
| | | "version": "7.0.4", |
| | | "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", |
| | | "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", |
| | | "license": "ISC", |
| | | "dependencies": { |
| | | "string-width": "^4.2.0", |
| | | "strip-ansi": "^6.0.0", |
| | | "wrap-ansi": "^7.0.0" |
| | | } |
| | | }, |
| | | "node_modules/color-convert": { |
| | | "version": "2.0.1", |
| | | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", |
| | | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", |
| | | "license": "MIT", |
| | | "dependencies": { |
| | | "color-name": "~1.1.4" |
| | | }, |
| | | "engines": { |
| | | "node": ">=7.0.0" |
| | | } |
| | | }, |
| | | "node_modules/color-name": { |
| | | "version": "1.1.4", |
| | | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", |
| | | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", |
| | | "license": "MIT" |
| | | }, |
| | | "node_modules/concat-map": { |
| | | "version": "0.0.1", |
| | | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", |
| | |
| | | "version": "2.0.3", |
| | | "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", |
| | | "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", |
| | | "license": "MIT", |
| | | "engines": { |
| | | "node": ">=6" |
| | | } |
| | | }, |
| | | "node_modules/emoji-regex": { |
| | | "version": "8.0.0", |
| | | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", |
| | | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", |
| | | "license": "MIT" |
| | | }, |
| | | "node_modules/escalade": { |
| | | "version": "3.2.0", |
| | | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", |
| | | "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", |
| | | "license": "MIT", |
| | | "engines": { |
| | | "node": ">=6" |
| | |
| | | "is-property": "^1.0.2" |
| | | } |
| | | }, |
| | | "node_modules/get-caller-file": { |
| | | "version": "2.0.5", |
| | | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", |
| | | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", |
| | | "license": "ISC", |
| | | "engines": { |
| | | "node": "6.* || 8.* || >= 10.*" |
| | | } |
| | | }, |
| | | "node_modules/glob-parent": { |
| | | "version": "5.1.2", |
| | | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", |
| | |
| | | "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", |
| | | "license": "ISC" |
| | | }, |
| | | "node_modules/ini": { |
| | | "version": "2.0.0", |
| | | "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", |
| | | "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", |
| | | "license": "ISC", |
| | | "engines": { |
| | | "node": ">=10" |
| | | } |
| | | }, |
| | | "node_modules/ipaddr.js": { |
| | | "version": "2.2.0", |
| | | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", |
| | |
| | | "license": "MIT", |
| | | "engines": { |
| | | "node": ">=0.10.0" |
| | | } |
| | | }, |
| | | "node_modules/is-fullwidth-code-point": { |
| | | "version": "3.0.0", |
| | | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", |
| | | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", |
| | | "license": "MIT", |
| | | "engines": { |
| | | "node": ">=8" |
| | | } |
| | | }, |
| | | "node_modules/is-glob": { |
| | |
| | | ], |
| | | "license": "MIT" |
| | | }, |
| | | "node_modules/lodash": { |
| | | "version": "4.17.21", |
| | | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", |
| | | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", |
| | | "license": "MIT" |
| | | }, |
| | | "node_modules/long": { |
| | | "version": "5.3.2", |
| | | "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", |
| | |
| | | }, |
| | | "engines": { |
| | | "node": ">=12.0.0" |
| | | } |
| | | }, |
| | | "node_modules/nconf": { |
| | | "version": "0.13.0", |
| | | "resolved": "https://registry.npmjs.org/nconf/-/nconf-0.13.0.tgz", |
| | | "integrity": "sha512-hJ/u2xCpA663h6xyOiztx3y+lg9eU0rdkwJ+c4FtiHo2g/gB0sjXtW31yTdMLWLOIj1gL2FcJMwfOqouuUK/Wg==", |
| | | "license": "MIT", |
| | | "dependencies": { |
| | | "async": "^3.0.0", |
| | | "ini": "^2.0.0", |
| | | "secure-keys": "^1.0.0", |
| | | "yargs": "^16.1.1" |
| | | }, |
| | | "engines": { |
| | | "node": ">= 0.4.0" |
| | | } |
| | | }, |
| | | "node_modules/nodemon": { |
| | |
| | | "node": ">= 12.13.0" |
| | | } |
| | | }, |
| | | "node_modules/require-directory": { |
| | | "version": "2.1.1", |
| | | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", |
| | | "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", |
| | | "license": "MIT", |
| | | "engines": { |
| | | "node": ">=0.10.0" |
| | | } |
| | | }, |
| | | "node_modules/require-from-string": { |
| | | "version": "2.0.2", |
| | | "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", |
| | |
| | | ], |
| | | "license": "BSD-3-Clause" |
| | | }, |
| | | "node_modules/secure-keys": { |
| | | "version": "1.0.0", |
| | | "resolved": "https://registry.npmjs.org/secure-keys/-/secure-keys-1.0.0.tgz", |
| | | "integrity": "sha512-nZi59hW3Sl5P3+wOO89eHBAAGwmCPd2aE1+dLZV5MO+ItQctIvAqihzaAXIQhvtH4KJPxM080HsnqltR2y8cWg==", |
| | | "license": "MIT" |
| | | }, |
| | | "node_modules/semver": { |
| | | "version": "7.7.2", |
| | | "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", |
| | |
| | | "node": ">= 0.6" |
| | | } |
| | | }, |
| | | "node_modules/string-width": { |
| | | "version": "4.2.3", |
| | | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", |
| | | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", |
| | | "license": "MIT", |
| | | "dependencies": { |
| | | "emoji-regex": "^8.0.0", |
| | | "is-fullwidth-code-point": "^3.0.0", |
| | | "strip-ansi": "^6.0.1" |
| | | }, |
| | | "engines": { |
| | | "node": ">=8" |
| | | } |
| | | }, |
| | | "node_modules/strip-ansi": { |
| | | "version": "6.0.1", |
| | | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", |
| | | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", |
| | | "license": "MIT", |
| | | "dependencies": { |
| | | "ansi-regex": "^5.0.1" |
| | | }, |
| | | "engines": { |
| | | "node": ">=8" |
| | | } |
| | | }, |
| | | "node_modules/supports-color": { |
| | | "version": "5.5.0", |
| | | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", |
| | |
| | | "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", |
| | | "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", |
| | | "license": "MIT" |
| | | }, |
| | | "node_modules/wrap-ansi": { |
| | | "version": "7.0.0", |
| | | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", |
| | | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", |
| | | "license": "MIT", |
| | | "dependencies": { |
| | | "ansi-styles": "^4.0.0", |
| | | "string-width": "^4.1.0", |
| | | "strip-ansi": "^6.0.0" |
| | | }, |
| | | "engines": { |
| | | "node": ">=10" |
| | | }, |
| | | "funding": { |
| | | "url": "https://github.com/chalk/wrap-ansi?sponsor=1" |
| | | } |
| | | }, |
| | | "node_modules/y18n": { |
| | | "version": "5.0.8", |
| | | "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", |
| | | "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", |
| | | "license": "ISC", |
| | | "engines": { |
| | | "node": ">=10" |
| | | } |
| | | }, |
| | | "node_modules/yargs": { |
| | | "version": "16.2.0", |
| | | "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", |
| | | "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", |
| | | "license": "MIT", |
| | | "dependencies": { |
| | | "cliui": "^7.0.2", |
| | | "escalade": "^3.1.1", |
| | | "get-caller-file": "^2.0.5", |
| | | "require-directory": "^2.1.1", |
| | | "string-width": "^4.2.0", |
| | | "y18n": "^5.0.5", |
| | | "yargs-parser": "^20.2.2" |
| | | }, |
| | | "engines": { |
| | | "node": ">=10" |
| | | } |
| | | }, |
| | | "node_modules/yargs-parser": { |
| | | "version": "20.2.9", |
| | | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", |
| | | "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", |
| | | "license": "ISC", |
| | | "engines": { |
| | | "node": ">=10" |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | }, |
| | | "dependencies": { |
| | | "fastify": "^5.3.3", |
| | | "lodash": "^4.17.21", |
| | | "mysql2": "^3.14.1", |
| | | "nconf": "^0.13.0", |
| | | "nodemon": "^3.1.10" |
| | | } |
| | | } |
| New file |
| | |
| | | { |
| | | "authtoken": "jiuGfr432898D90290kjfsldkfn3hh8F", |
| | | "port": 4101, |
| | | "db": { |
| | | "host": "localhost", |
| | | "port": 33009, |
| | | "database": "ilias", |
| | | "user": "root", |
| | | "password": "paaa322ss" |
| | | } |
| | | } |
| New file |
| | |
| | | { |
| | | "authtoken": "jiuGfr432898D90290kjfsldkfn3hh8F", |
| | | "port": 4101, |
| | | "db": { |
| | | "host": "localhost", |
| | | "port": 33009, |
| | | "database": "ilias", |
| | | "user": "root", |
| | | "password": "paaa322ss" |
| | | } |
| | | } |
| | |
| | | module.exports = { |
| | | authtoken: "jiuGfr432898D90290kjfsldkfn3hh8F", |
| | | port: 4101, |
| | | db: { |
| | | host: "localhost", |
| | | port: 33009, |
| | | database: "ilias", |
| | | user: 'root', |
| | | password: 'paaa322ss', |
| | | }, |
| | | } |
| | | var nconf = require("nconf") |
| | | |
| | | var env = process.env["NODE_ENV"] |
| | | if (!env) throw new Error("NODE_ENV required!") |
| | | console.log("Using NODE_ENV='%s'", env) |
| | | |
| | | var file = "settings." + env + ".json" |
| | | console.log("Reading config file '%s'", file) |
| | | nconf.file("prod", file) |
| | | nconf.file("default", "settings.default.json") |
| | | |
| | | var settings = nconf.get() |
| | | console.log(settings) |
| | | |
| | | module.exports = settings |
| New file |
| | |
| | | { |
| | | "authtoken": "jiuGfr432898D90290kjfsldkfn3hh8F", |
| | | "port": 4101, |
| | | "db": { |
| | | "host": "localhost", |
| | | "port": 3306, |
| | | "database": "ilias_globusfachtest", |
| | | "user": "globusfachtestadmin", |
| | | "password": "f5A3IO2x8ulOxEMe10i8" |
| | | } |
| | | } |
| | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | async function run() { |
| | | |
| | | const settings = require("./settings") |
| | | console.log(settings) |
| | | |
| | | // const user = await db.getUserByLogin("242424") |
| | | // console.log("user", user) |
| | | // |
| | |
| | | // console.log(udf) |
| | | // console.timeEnd("udf") |
| | | |
| | | console.time("udf1") |
| | | // const usr = await db.getUserByUserId(316) |
| | | const usr = await db.getUserByLogin("051134") |
| | | console.log(usr) |
| | | console.timeEnd("udf1") |
| | | // console.time("udf1") |
| | | // // const usr = await db.getUserByUserId(316) |
| | | // const usr = await db.getUserByLogin("051134") |
| | | // console.log(usr) |
| | | // console.timeEnd("udf1") |
| | | |
| | | // console.time("udf1") |
| | | // const udf1 = await db.getUserDefinedField(316) |