Skip to content

Commit

Permalink
build ts
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasimir committed Aug 25, 2021
1 parent b07a006 commit c5cd98f
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 127 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,9 @@ $RECYCLE.BIN/

node_modules

lib
lib

**/*.d.ts
**/*.js
**/*.js.map
!**/initdb/*.js
16 changes: 0 additions & 16 deletions docker/sharded/config.js

This file was deleted.

15 changes: 15 additions & 0 deletions docker/sharded/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const path = require("path");

export default {
dockerCompose: {
projectName: path.basename(__dirname),
yamlPath: path.resolve(__dirname, "docker-compose.yaml"),
},
waitOn: ["tcp:28004"],
connections: {
default: {
connectionString:
"mongodb://root:password123@localhost:28004/db1?authSource=admin",
},
},
};
41 changes: 0 additions & 41 deletions docker/ssh/config.js

This file was deleted.

43 changes: 43 additions & 0 deletions docker/ssh/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const path = require("path");

export default {
dockerCompose: {
projectName: path.basename(__dirname),
yamlPath: path.resolve(__dirname, "docker-compose.yaml"),
},
waitOn: ["tcp:28006"],
connections: {
password: {
connectionString: "mongodb://mongo:27017",
sshTunnel: {
host: "localhost",
port: 22222,
username: "root",
password: "password",
},
},
identityKey: {
connectionString: "mongodb://mongo:27017",
sshTunnel: {
host: "localhost",
port: 22222,
username: "root",
identityKeyFile: path.resolve(
__dirname,
"keys",
"key-without-passphrase"
),
},
},
identityKeyWithPassphrase: {
connectionString: "mongodb://mongo:27017",
sshTunnel: {
host: "localhost",
port: 22222,
username: "root",
identityKeyFile: path.resolve(__dirname, "keys", "key-with-passphrase"),
identityKeyPassphrase: "passphrase",
},
},
},
};
65 changes: 0 additions & 65 deletions docker/tls/config.js

This file was deleted.

80 changes: 80 additions & 0 deletions docker/tls/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const path = require("path");

const { default: ConnectionString } = require("mongodb-connection-string-url");

const unvalidated = new ConnectionString("mongodb://localhost:27029");
unvalidated.searchParams.set("tls", "true");
unvalidated.searchParams.set("tlsInsecure", "true");

const serverValidation = new ConnectionString("mongodb://localhost:27029");
serverValidation.searchParams.set("tls", "true");
serverValidation.searchParams.set(
"tlsCAFile",
path.resolve(__dirname, "tls", "ca.pem")
);

const serverAndClientValidation = new ConnectionString(
"mongodb://localhost:27030"
);
serverAndClientValidation.searchParams.set("tls", "true");
serverAndClientValidation.searchParams.set(
"tlsCAFile",
path.resolve(__dirname, "tls", "ca.pem")
);
serverAndClientValidation.searchParams.set(
"tlsCertificateKeyFile",
path.resolve(__dirname, "tls", "client.pem")
);

const x509 = new ConnectionString("mongodb://localhost:27031");
x509.searchParams.set("tls", "true");
x509.searchParams.set("tlsCAFile", path.resolve(__dirname, "tls", "ca.pem"));
x509.searchParams.set(
"tlsCertificateKeyFile",
path.resolve(__dirname, "tls", "client.pem")
);
x509.searchParams.set("authMechanism", "MONGODB-X509");

const x509WithSsh = new ConnectionString("mongodb://mongodb-tls-x509:27017");
x509WithSsh.searchParams.set("tls", "true");
x509WithSsh.searchParams.set("tlsAllowInvalidHostnames", "true");
x509WithSsh.searchParams.set(
"tlsCAFile",
path.resolve(__dirname, "tls", "ca.pem")
);
x509WithSsh.searchParams.set(
"tlsCertificateKeyFile",
path.resolve(__dirname, "tls", "client.pem")
);
x509WithSsh.searchParams.set("authMechanism", "MONGODB-X509");

export default {
dockerCompose: {
projectName: path.basename(__dirname),
yamlPath: path.resolve(__dirname, "docker-compose.yaml"),
},
waitOn: ["tcp:27029", "tcp:27030", "tcp:27031", "tcp:22223"],
connections: {
unvalidated: {
connectionString: unvalidated.href,
},
serverValidation: {
connectionString: serverValidation.href,
},
serverAndClientValidation: {
connectionString: serverAndClientValidation.href,
},
x509: {
connectionString: x509.href,
},
x509WithSsh: {
connectionString: x509WithSsh.href,
sshTunnel: {
host: "localhost",
port: 22223,
username: "root",
password: "password",
},
},
},
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"clean": "rimraf lib",
"precompile": "npm run clean",
"compile": "npm run compile-ts",
"compile-ts": "tsc -p tsconfig.json"
"compile-ts": "tsc -p tsconfig.json",
"prepare": "npm run compile"
},
"repository": {
"type": "git",
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"allowJs": true,
"allowJs": false,
"esModuleInterop": true,
"downlevelIteration": true,
"declaration": true,
Expand All @@ -11,8 +11,7 @@
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2018",
"outDir": "lib"
"target": "es2018"
},
"include": ["**/*"],
"exclude": ["./src/**/*.spec.*"]
Expand Down

0 comments on commit c5cd98f

Please sign in to comment.