Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
mysql-in-docker
Advanced tools
Module starts mysql server inside docker container. This is helpful while testing.
NOTE: Docker required.
npm i mysql-in-docker --save
interface IMySqlInDockerOptions {
// database name to create [optional]
database?: string;
// database user name to create [optional]
user?: string;
// database user password to create [optional]
password?: string;
// if true, then sequelize v3 will be used for models [optional]
sequelizeV3?: boolean;
// use mysql v8, by default v5 is used [optional]
// NOTE: V8 is configured to use native authentication,
// because sequelize has issues with new auth method
mysqlV8?: boolean;
// path to folder(s)/file(s) with sequelize models [optional]
models?: string | string[];
// path with sql scripts [optional]
// this path is used when you specify 'my-query.sql' in query instead of
// sql query, module tries to locate 'my-query.sql' inside this folder
scriptsDir?: string;
// if true, all actions will be logged to console, default is false [optional]
verbose?: boolean;
// if specified, then it will be used to store mysql database after shutdown
// note: should be accessible by docker
storage?: string;
}
Constructor
Starts docker container with mysql server.
If succeeded, then port
, host
, etc. properties become available.
Stops running docker container.
After completion all port
, host
, etc. properties become unavailable.
Returns method to be used to execute SQL queries. Query also can contain name of the file to be executed, e.g: my-query.sql. Returns rows.
Return sequelize model by name, if they where loaded from specified path(s).
Returns domain or ip of running MySql server.
Returns port MySql server is listening to.
Returns name of database.
Returns mysql user.
Returns mysql password for user.
const MySqlContainer = require('mysql-in-docker');
async function main() {
const options = {
// See IMySqlInDockerOptions
};
// instantiate
const container = new MySqlContainer(options);
// boot
await container.start();
const port = container.port;
const host = container.host;
const database = container.database;
const user = container.user;
const password = container.password;
// do some work
...
// shutdown
await container.stop();
}
or if you want to use storage:
const MySqlContainer = require('mysql-in-docker');
async function main() {
const options = {
// See IMySqlInDockerOptions
storage: '/my-path'
// we should explicitly specify database, user and password
// to be able to use it after restore
database: 'test',
user: 'test',
password: 'test',
};
// instantiate
const container = new MySqlContainer(options);
// boot
await container.start();
const port = container.port;
const host = container.host;
const database = container.database;
const user = container.user;
const password = container.password;
// do some work
...
// shutdown
await container.stop();
// Restore after some from the same storage
await container.start();
// Work with restored database
...
// shutdown again
await container.stop();
}
MIT. See LICENSE
Siarhei Ladzeika sergey.ladeiko@gmail.com
FAQs
## Purpose
The npm package mysql-in-docker receives a total of 2 weekly downloads. As such, mysql-in-docker popularity was classified as not popular.
We found that mysql-in-docker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.