Compare commits

...

4 Commits

Author SHA1 Message Date
semantic-release-bot 750a3bafd4 chore(release): 0.1.0-develop.2 [skip ci]
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-08-31)

### Bug Fixes

* ensure db path exists, create if not ([632eb13](632eb1351c))
* set default db path ([51618df](51618dfaf3))
2023-08-31 16:15:37 +00:00
Derrick Hammer 49eb1bab8a
Merge remote-tracking branch 'origin/develop' into develop 2023-08-31 12:14:50 -04:00
Derrick Hammer 51618dfaf3
fix: set default db path 2023-08-31 12:14:42 -04:00
Derrick Hammer 632eb1351c
fix: ensure db path exists, create if not 2023-08-31 12:14:28 -04:00
5 changed files with 22 additions and 7 deletions

View File

@ -1,3 +1,11 @@
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-08-31)
### Bug Fixes
* ensure db path exists, create if not ([632eb13](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/632eb1351c92825c10681487efc7cfa3f5cebac6))
* set default db path ([51618df](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/51618dfaf38c4dc9ad70fc6a76ca11ef37fad0f5))
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.0.1...v0.1.0-develop.1) (2023-08-31)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/relay-plugin-s5",
"version": "0.1.0-develop.1",
"version": "0.1.0-develop.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/relay-plugin-s5",
"version": "0.1.0-develop.1",
"version": "0.1.0-develop.2",
"dependencies": {
"@lumeweb/interface-relay": "^0.0.2-develop.3",
"@lumeweb/libs5": "^0.1.0-develop.9",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/relay-plugin-s5",
"version": "0.1.0-develop.1",
"version": "0.1.0-develop.2",
"type": "module",
"repository": {
"type": "git",

View File

@ -1,6 +1,7 @@
{
"plugins": {
"s5": {
"db": "/etc/lumeweb/relay/plugins/s5/db",
"p2p": {
"peers": {
"initial": [

View File

@ -4,14 +4,20 @@ import { Level } from "level";
import { PROTOCOL } from "./constants.js";
import HyperTransportPeer from "./hyperTransport.js";
import { NodeId } from "@lumeweb/libs5";
import { string } from "micro-packed";
import * as fs from "fs/promises";
const plugin = {
name: "s5",
async plugin(api: PluginAPI) {
const db = new Level<string, Uint8Array>(
api.pluginConfig.str("db") as string,
);
const dbPath = api.pluginConfig.str("db") as string;
try {
await fs.access(dbPath);
} catch {
await fs.mkdir(dbPath, { recursive: true });
}
const db = new Level<string, Uint8Array>(dbPath);
await db.open();
let config = {
keyPair: createKeyPair(api.identity.publicKeyRaw),