New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ac-bootstrap-mysql

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ac-bootstrap-mysql

Mysql init for AC apps

  • 2.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-37.5%
Maintainers
0
Weekly downloads
 
Created
Source

ac-bootstrap-mysql

Please use this script whenever you want to connect to our AdmiralCloud databases.

This new version supports async/await but is still fully backwards compatible. It supports the current AWS certificates.

Setup

Configuration

Make sure the configuration is available at app.config (acapi.config):

const app = {
  config: {
    database: {
      dataTimeFormat: 'YYYY-MM-DD HH:mm:ss',
      servers: [
        { 
          server: 'your_name_for_the_database', 
          host: 'localhost', 
          port: 3306, 
          user: 'your_user',
          password: 'your_password',
          ssl: 'Amazon RDS' // required on LIVE infrastructure, remove on local or DEV stage
        }
      ]
    }
  }
}

Note: Usually host, user, password and ssl should come from a AWS secret! You can overwrite all values with a values from app.config.localDatabase.

Usage in your code

Init

Init during bootstrap:

await acbMysql(app)

// with callback
acbMysql(app, { bootstrapping: true }, err => {
  ...
})

If you use bootstrapping: true the callback function will return with an error, otherwise it will log an error and exit the process.

Queries

Now you have the database connection available using async/await or callback (deprecated). The with await use app.mysqlPromise, with callback use app.mysql.

const query = 'SELECT * FROM user WHERE id = 1'
const [ rows, fields ] = await app.mysqlPromise[your_name_for_the_database].query(query)

// with callback
app.mysql[your_name_for_the_database].query(query, (err, result) => {
  // 
})

FAQs

Package last updated on 25 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc