@brimble/models 1.4.77 → 1.4.79

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.
@@ -1,3 +1,3 @@
1
1
  yarn run v1.22.19
2
2
  $ tsc -p .
3
- Done in 2.90s.
3
+ Done in 1.92s.
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: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
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 = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
58
+ const connectToMongo = (config) => __awaiter(void 0, void 0, void 0, function* () {
59
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(mongoUrl, options).catch((err) => {
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "1.4.77",
3
+ "version": "1.4.79",
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": "504c2165668055fed10743d02e2a2130c6f5f8a7"
24
+ "gitHead": "abee06cf597165cc50cceb23054914eff48607ec"
25
25
  }