Giter VIP home page Giter VIP logo

database-lib's Introduction

database-lib

Git Commit Git Releases Npm Version NPM Vulnerabilities CircleCI

Shared database code for central services

Contents:

Usage

The library supports both MySQL and Postgres. To use the library you can use the following configurations:

const connectionConfig = {
    client: 'mysql', //or 'pg' for postgres
    connection: {
      host: 'some-data-uri',
      port: '9999',
      user: 'user',
      password: 'password',
      database: 'databaseSchema'
    },
    pool: {
      // minimum size
      min: 2,
      // maximum size
      max: 10,
      // acquire promises are rejected after this many milliseconds
      // if a resource cannot be acquired
      acquireTimeoutMillis: 30000,
      // create operations are cancelled after this many milliseconds
      // if a resource cannot be acquired
      createTimeoutMillis: 3000,
      // destroy operations are awaited for at most this many milliseconds
      // new resources will be created after this timeout
      destroyTimeoutMillis: 5000,
      // free resouces are destroyed after this many milliseconds
      idleTimeoutMillis: 30000,
      // how often to check for idle resources to destroy
      reapIntervalMillis: 1000,
      // long long to idle after failed create before trying again
      createRetryIntervalMillis: 200
      // ping: function (conn, cb) { conn.query('SELECT 1', cb) }
    },
    debug: false
  }

Environmental variables

Currently all is set into the config.

Logging

Logs are sent to standard output by default.

Tests

Running the tests:

npm run test
npm run test:unit
npm run test:xunit
npm run test:coverage
npm run test:coverage-check

Tests include code coverage via istanbul. See the test/unit/ folder for testing scripts.

Auditing Dependencies

We use npm-audit-resolver along with npm audit to check dependencies for vulnerabilities, and keep track of resolved dependencies with an audit-resolv.json file.

To start a new resolution process, run:

npm run audit:resolve

You can then check to see if the CI will pass based on the current dependencies with:

npm run audit:check

And commit the changed audit-resolv.json to ensure that CircleCI will build correctly.

database-lib's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar elnyry-sam-k avatar ggrg avatar henkkodde avatar kjw000 avatar lewisdaly avatar mdebarros avatar oderayi avatar rmothilal avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

database-lib's Issues

Export code coverage for this repo

the central-services-database code has tests, but the code coverage is not being exported to SonarQube
The tests should create a lcov.info file and copy it to S3 for pickup

  • aws s3 cp ./coverage/lcov.info s3://elasticbeanstalk-us-west-2-886403637725/sonar/central-services-database /

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.