From 6d52e6993251d6f1149d8e1153e1933a102fb882 Mon Sep 17 00:00:00 2001
From: HDegroote <75906619+HDegroote@users.noreply.github.com>
Date: Fri, 19 Jul 2024 00:16:35 +0200
Subject: [PATCH] Add bin
---
README.md | 8 ++++----
package.json | 5 ++++-
run.js | 2 ++
3 files changed, 10 insertions(+), 5 deletions(-)
mode change 100644 => 100755 run.js
diff --git a/README.md b/README.md
index 0b4b65f..4ea5db7 100644
--- a/README.md
+++ b/README.md
@@ -28,14 +28,14 @@ Note: `/etc/prometheus/config/prometheus-dht-targets` should be writable by the
#### CLI
+Install:
```
-DHT_PROM_PROMETHEUS_TARGETS_LOC=path/to/prometheus/targets.json DHT_PROM_HTTP_PORT=30000 DHT_PROM_SHARED_SECRET= dht-prometheus
+npm i -g dht-prometheus
```
-## Install
-
+Run:
```
-npm i dht-prometheus
+DHT_PROM_PROMETHEUS_TARGETS_LOC=path/to/prometheus/targets.json DHT_PROM_HTTP_PORT=30000 DHT_PROM_SHARED_SECRET= dht-prometheus
```
## Test
diff --git a/package.json b/package.json
index f377909..1ccbe00 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,14 @@
{
"name": "dht-prometheus",
"version": "0.0.0",
- "description": "Bridge to scrape Prometheus metrics exposed over hyperdht",
+ "description": "Bridge to scrape Prometheus metrics fully peer to peer",
"main": "index.js",
"scripts": {
"test": "standard && brittle test/test.js && ./prep-integration-test.sh && brittle test/integration.js"
},
+ "bin": {
+ "dht-prometheus": "./run.js"
+ },
"repository": {
"type": "git",
"url": "git+https://github.com/HDegroote/dht-prometheus.git"
diff --git a/run.js b/run.js
old mode 100644
new mode 100755
index 349f2b6..81736f1
--- a/run.js
+++ b/run.js
@@ -1,3 +1,5 @@
+#! /usr/bin/env node
+
const HyperDHT = require('hyperdht')
const PrometheusDhtBridge = require('./index')
const pino = require('pino')