1.0.1 • Published 4 years ago

parse-connection-string v1.0.1

Weekly downloads
2
License
ISC
Repository
-
Last release
4 years ago

parse-connection-string

parse-connection-string takes a standard MS SQL server connection string, parses it and converts into a format suitable for Knex.

API

import parse from "parse-connection-string";
import knex from "knex";

const connStr = process.env.MSSQL_CONNECTION_STRING;
const config = parse(connStr).toKnexConfig();

const db = knex({
  client: "mssql",
  connection: config
});

Simply pass your connection string into the parseConnectionString function and call one of the output functions on the result to get the options in the format you want. At the moment there's only toKnexConfig(). Other formats will be added as necessary.

Running Tests

Run yarn test in this directory to run unit tests.