Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
99845a7b94 | |||
60b0c2f577 | |||
58e4ab1886 | |||
26f9b8d208 |
@ -5,6 +5,7 @@ database=openauth
|
||||
[core]
|
||||
name = OpenAuthService
|
||||
secret = dev
|
||||
url=http://localhost:3000
|
||||
|
||||
[web]
|
||||
port = 3000
|
||||
|
@ -48,7 +48,7 @@
|
||||
"@hibas123/nodeloggingserver_client": "^1.1.2",
|
||||
"@hibas123/openauth-internalapi": "workspace:^",
|
||||
"@hibas123/openauth-views-v1": "workspace:^",
|
||||
"@hibas123/safe_mongo": "^2.1.0",
|
||||
"@hibas123/safe_mongo": "2.0.1",
|
||||
"@simplewebauthn/server": "^7.2.0",
|
||||
"body-parser": "^1.20.2",
|
||||
"compression": "^1.7.4",
|
||||
|
@ -1,22 +1,21 @@
|
||||
import SafeMongo from "@hibas123/safe_mongo";
|
||||
import Config from "./config";
|
||||
let dbname = "openauth";
|
||||
let host = "localhost";
|
||||
if (Config.database) {
|
||||
if (Config.database.database) dbname = Config.database.database;
|
||||
if (Config.database.host) host = Config.database.host;
|
||||
}
|
||||
if (Config.core.dev) dbname += "_dev";
|
||||
|
||||
let auth = undefined;
|
||||
if (Config.database.username) {
|
||||
auth = {
|
||||
username: Config.database.username,
|
||||
password: Config.database.password
|
||||
}
|
||||
|
||||
const host = Config.database.host || "localhost";
|
||||
// const port = Config.database.port || "27017";
|
||||
const port = "27017";
|
||||
const database = Config.database.database || "openauth";
|
||||
const url = new URL(`mongodb://${host}:${port}/${database}`);
|
||||
|
||||
const user = Config.database.username || undefined;
|
||||
const passwd = Config.database.password || undefined;
|
||||
|
||||
if (user) {
|
||||
url.username = user;
|
||||
if (passwd) url.password = passwd;
|
||||
}
|
||||
|
||||
const DB = new SafeMongo("mongodb://" + host, dbname, {
|
||||
auth
|
||||
});
|
||||
|
||||
const DB = new SafeMongo(url.href, database);
|
||||
export default DB;
|
||||
|
@ -46,7 +46,7 @@ export default class Web {
|
||||
resave: false,
|
||||
saveUninitialized: false,
|
||||
store: MongoStore.create({
|
||||
client: DB.getClient(),
|
||||
client: DB.getClient() as any,
|
||||
dbName: DB.db.databaseName,
|
||||
collectionName: "sessions",
|
||||
autoRemove: "native",
|
||||
|
53
yarn.lock
53
yarn.lock
@ -485,7 +485,7 @@ __metadata:
|
||||
"@hibas123/nodeloggingserver_client": ^1.1.2
|
||||
"@hibas123/openauth-internalapi": "workspace:^"
|
||||
"@hibas123/openauth-views-v1": "workspace:^"
|
||||
"@hibas123/safe_mongo": ^2.1.0
|
||||
"@hibas123/safe_mongo": 2.0.1
|
||||
"@simplewebauthn/server": ^7.2.0
|
||||
"@types/body-parser": ^1.19.2
|
||||
"@types/compression": ^1.7.2
|
||||
@ -612,13 +612,13 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@hibas123/safe_mongo@npm:^2.1.0":
|
||||
version: 2.1.0
|
||||
resolution: "@hibas123/safe_mongo@npm:2.1.0"
|
||||
"@hibas123/safe_mongo@npm:2.0.1":
|
||||
version: 2.0.1
|
||||
resolution: "@hibas123/safe_mongo@npm:2.0.1"
|
||||
dependencies:
|
||||
"@hibas123/logging": ^3.1.2
|
||||
mongodb: ^6.0.0
|
||||
checksum: 8c8125a9f50d26494094315029e7ce352cf19469e6c5f5a727e3c643e66c2b87b3e3587b6b4d9b3d28835f095512b9b9de0a2e5532e20d53d5f9c64ad7983480
|
||||
mongodb: ^5.2.0
|
||||
checksum: 6d02d6803312a61de23a741eb7b72b92e7443f76ffecce7faa4887109f6478ed5ad2920bd92371db23e1108fb6dfd83a0adcedf1448708c03ba51f564ba20afd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -2258,6 +2258,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"bson@npm:^5.5.0":
|
||||
version: 5.5.1
|
||||
resolution: "bson@npm:5.5.1"
|
||||
checksum: f49730504e8362e2c8d1eb0c272e5e125392c41fb7196fc35ccbc39718ee62569a1d197bd2342c3334cd420073d3fd5dc7dea764a7f219dcd79e0ce473dd2772
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"bson@npm:^6.2.0":
|
||||
version: 6.2.0
|
||||
resolution: "bson@npm:6.2.0"
|
||||
@ -5726,7 +5733,39 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"mongodb@npm:^6.0.0, mongodb@npm:^6.3.0":
|
||||
"mongodb@npm:^5.2.0":
|
||||
version: 5.9.1
|
||||
resolution: "mongodb@npm:5.9.1"
|
||||
dependencies:
|
||||
"@mongodb-js/saslprep": ^1.1.0
|
||||
bson: ^5.5.0
|
||||
mongodb-connection-string-url: ^2.6.0
|
||||
socks: ^2.7.1
|
||||
peerDependencies:
|
||||
"@aws-sdk/credential-providers": ^3.188.0
|
||||
"@mongodb-js/zstd": ^1.0.0
|
||||
kerberos: ^1.0.0 || ^2.0.0
|
||||
mongodb-client-encryption: ">=2.3.0 <3"
|
||||
snappy: ^7.2.2
|
||||
dependenciesMeta:
|
||||
"@mongodb-js/saslprep":
|
||||
optional: true
|
||||
peerDependenciesMeta:
|
||||
"@aws-sdk/credential-providers":
|
||||
optional: true
|
||||
"@mongodb-js/zstd":
|
||||
optional: true
|
||||
kerberos:
|
||||
optional: true
|
||||
mongodb-client-encryption:
|
||||
optional: true
|
||||
snappy:
|
||||
optional: true
|
||||
checksum: a827937120cd7eecafc0ad5657b40536774f0b09582a9363db0a192149ba20eae80a33fccf573f5ce69a20aca6759c40b4961d9d1d4de2a350c543030055e0f6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"mongodb@npm:^6.3.0":
|
||||
version: 6.3.0
|
||||
resolution: "mongodb@npm:6.3.0"
|
||||
dependencies:
|
||||
|
Reference in New Issue
Block a user