https://github.com/interledgerjs/ilp-store
An ILP store loader for key/value stores used by ILP components
https://github.com/interledgerjs/ilp-store
Last synced: 11 months ago
JSON representation
An ILP store loader for key/value stores used by ILP components
- Host: GitHub
- URL: https://github.com/interledgerjs/ilp-store
- Owner: interledgerjs
- Created: 2018-09-12T09:14:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-23T12:43:23.000Z (about 7 years ago)
- Last Synced: 2025-01-22T21:37:36.932Z (12 months ago)
- Language: TypeScript
- Size: 42 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ILP Store
> An ILP store loader for key/value stores used by ILP components
[](https://npmjs.org/package/ilp-store)
[](https://circleci.com/gh/interledgerjs/ilp-store)
[](https://snyk.io/test/github/interledgerjs/ilp-store)
The script below will create an instance of an ILP store with no setup whatsoever. You can
use this anywhere that you need a key value store for use by an ILP component.
**IMPORTANT**: The default store is an in-memory store that will lose all of its data when the process exits. For persistent storage consider one of the other `ilp-store-*` modules such as `ilp-store-redis` or `ilp-store-simpledb`.
## Examples
Javascript:
```js
const store = require('ilp-store')()
async function run () {
await store.put('key', 'some value')
const value = await store.get('key')
process.exit(0)
}
run()
```
TypeScript:
```typescript
import createStore from 'ilp-store'
const store = createStore()
async function run () {
await store.put('key', 'some value')
const value = await store.get('key')
process.exit(0)
}
run()
```
If no parameters are provided it will attempt to find the config in environment variables. If these are not found it will load an in-memory store.
The Environment variables that can be set are:
- `ILP_STORE` : The name/path of the store module
- `ILP_STORE_OPTIONS` : The options passed to the constructor, serialized as a JSON object.
The options object passed are a subset of the configuration object used in `ilp-connector`.