@brimble/models 1.4.76 → 1.4.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -3
- package/index.ts +5 -3
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export { default as Tenancy } from "./tenancy";
|
|
|
15
15
|
export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IServer, ITenancy, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscriptionPlan, ICard } from "./types";
|
|
16
16
|
export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES } from "./enum";
|
|
17
17
|
import mongoose from "mongoose";
|
|
18
|
-
export declare const connectToMongo: (
|
|
18
|
+
export declare const connectToMongo: (config: mongoose.ConnectOptions & {
|
|
19
|
+
host: string;
|
|
20
|
+
}) => Promise<void>;
|
|
19
21
|
export declare const db: mongoose.Connection;
|
|
20
22
|
export declare const closeMongo: () => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -55,12 +55,12 @@ Object.defineProperty(exports, "CARD_TYPES", { enumerable: true, get: function (
|
|
|
55
55
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
56
56
|
const utils_1 = require("@brimble/utils");
|
|
57
57
|
// Connection to Mongo
|
|
58
|
-
const connectToMongo = (
|
|
59
|
-
const options = Object.assign({ useNewUrlParser: true, useUnifiedTopology: true, poolSize: 10, socketTimeoutMS: 30000, reconnectTries: 10, reconnectInterval: 3000 }, config);
|
|
58
|
+
const connectToMongo = (config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
const options = Object.assign({ useNewUrlParser: true, useUnifiedTopology: true, poolSize: 10, socketTimeoutMS: 30000, reconnectTries: 10, reconnectInterval: 3000, checkServerIdentity: false, authMechanism: 'MONGODB-X509', authSource: '$external' }, config);
|
|
60
60
|
mongoose_1.default.set("useFindAndModify", false);
|
|
61
61
|
mongoose_1.default.set("useCreateIndex", true);
|
|
62
62
|
// connect to mongo
|
|
63
|
-
mongoose_1.default.connect(
|
|
63
|
+
mongoose_1.default.connect(`mongodb+srv://${config.host}/?authMechanism=MONGODB-X509&authSource=%24external&tls=true&tlsCertificateKeyFile=${config.sslCert}`, options).catch((err) => {
|
|
64
64
|
utils_1.log.error(`Unable to connect to mongo db, ${err}`);
|
|
65
65
|
});
|
|
66
66
|
// listen for connection
|
package/index.ts
CHANGED
|
@@ -49,8 +49,7 @@ import { log } from "@brimble/utils";
|
|
|
49
49
|
|
|
50
50
|
// Connection to Mongo
|
|
51
51
|
export const connectToMongo = async (
|
|
52
|
-
|
|
53
|
-
config?: mongoose.ConnectOptions
|
|
52
|
+
config: mongoose.ConnectOptions & { host: string}
|
|
54
53
|
): Promise<void> => {
|
|
55
54
|
const options: mongoose.ConnectOptions = {
|
|
56
55
|
useNewUrlParser: true,
|
|
@@ -59,13 +58,16 @@ export const connectToMongo = async (
|
|
|
59
58
|
socketTimeoutMS: 30000,
|
|
60
59
|
reconnectTries: 10,
|
|
61
60
|
reconnectInterval: 3000,
|
|
61
|
+
checkServerIdentity: false,
|
|
62
|
+
authMechanism: 'MONGODB-X509',
|
|
63
|
+
authSource: '$external',
|
|
62
64
|
...config
|
|
63
65
|
};
|
|
64
66
|
mongoose.set("useFindAndModify", false);
|
|
65
67
|
mongoose.set("useCreateIndex", true);
|
|
66
68
|
|
|
67
69
|
// connect to mongo
|
|
68
|
-
mongoose.connect(
|
|
70
|
+
mongoose.connect(`mongodb+srv://${config.host}/?authMechanism=MONGODB-X509&authSource=%24external&tls=true&tlsCertificateKeyFile=${config.sslCert}`, options).catch((err) => {
|
|
69
71
|
log.error(`Unable to connect to mongo db, ${err}`)
|
|
70
72
|
});
|
|
71
73
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brimble/models",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.78",
|
|
4
4
|
"description": "Brimble models",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"ts-node": "^8.10.2",
|
|
22
22
|
"typescript": "^4.9.4"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "51b26cb5f0e96321c047c9ba4e8690bfd8f712f8"
|
|
25
25
|
}
|