advisory-lock
Advanced tools
Comparing version 1.0.2 to 1.1.0
{ | ||
"name": "advisory-lock", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Distributed locking using PostgreSQL advisory locks", | ||
"main": "lib/index.js", | ||
"bin": { | ||
"withlock": "./lib/bin/withlock.js" | ||
}, | ||
"scripts": { | ||
@@ -51,4 +54,5 @@ "pretest": "npm run lint", | ||
"debug": "^2.2.0", | ||
"minimist": "^1.2.0", | ||
"pg": "^4.5.5" | ||
} | ||
} |
@@ -32,2 +32,26 @@ # advisory-lock | ||
## CLI Usage | ||
A `withlock` command line utility is provided to make to facilitate the | ||
common use case of ensuring only one instance of a process is running at any | ||
time. | ||
![withlock demo](./withlock-demo.gif) | ||
```bash | ||
withlock <lockName> [--db <connectionString>] -- <command> | ||
``` | ||
Where `<lockName>` is the name of the lock, `<command>` (everything after | ||
`--`) is the command to run exclusively, once the lock is acquired. | ||
`--db <connectionString>` is optional and if not specified, the | ||
`PG_CONNECTION_STRING` environment variable will be used. | ||
Example: | ||
```bash | ||
export PG_CONNECTION_STRING="postgres://postgres@127.0.0.1/mydb" | ||
withlock dbmigration -- npm run knex migrate:latest | ||
``` | ||
## Usage | ||
@@ -34,0 +58,0 @@ |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
143583
8
206
163
3
2
1
+ Addedminimist@^1.2.0
+ Addedminimist@1.2.8(transitive)