aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-10-06 03:22:11 +0000
committerAdam Soltys <[email protected]>2022-10-06 03:22:11 +0000
commit397e77d8fec8f7455919468a98a8292b2de78228 (patch)
tree02e4c7b8a0821e7bdc947f0903a16f26a0c87ec2
parentfb91aa048617f0894e01c1e890ec957a3170539f (diff)
downloadcoinos-server-397e77d8fec8f7455919468a98a8292b2de78228.tar.gz
coinos-server-397e77d8fec8f7455919468a98a8292b2de78228.zip
env vars
-rw-r--r--lib/sendInternal.js3
-rw-r--r--prod.yml5
-rw-r--r--routes/bitcoin/receive.js4
-rw-r--r--routes/lightning/parse.js7
-rw-r--r--routes/lnurl.js4
-rw-r--r--routes/send.js2
6 files changed, 16 insertions, 9 deletions
diff --git a/lib/sendInternal.js b/lib/sendInternal.js
index fbe4d95f..e8e5e1b6 100644
--- a/lib/sendInternal.js
+++ b/lib/sendInternal.js
@@ -10,9 +10,10 @@ import { sendLiquid } from "$routes/liquid/send";
import { l, err } from "$lib/logging";
import { fail } from "$lib/utils";
+const { HOSTNAME: hostname } = process.env;
+
export default async (
{ amount, address, payreq, unconfidential, asset, memo, username },
- hostname,
user
) => {
amount = parseInt(amount);
diff --git a/prod.yml b/prod.yml
index ceacf11e..bd3feba4 100644
--- a/prod.yml
+++ b/prod.yml
@@ -19,6 +19,10 @@ services:
image: coinos-ui
restart: always
pull_policy: never
+ environment:
+ PUBLIC_COINOS_URL: "${PUBLIC_COINOS_URL}"
+ PUBLIC_BTC: "${PUBLIC_BTC}"
+ PUBLIC_SOCKET: "${PUBLIC_SOCKET}"
app:
depends_on:
- cl
@@ -31,6 +35,7 @@ services:
environment:
NODE_ENV: production
NODE_OPTIONS: "--es-module-specifier-resolution=node --experimental-modules --loader ./loader.js --openssl-legacy-provider"
+ HOSTNAME: "${HOSTNAME}"
volumes:
- ./:/app
- ./logs:/logs
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js
index 665cc2bc..eb1c7868 100644
--- a/routes/bitcoin/receive.js
+++ b/routes/bitcoin/receive.js
@@ -67,7 +67,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => {
transaction
});
- const invoice = await db.Invoice.findOne({
+ let invoice = await db.Invoice.findOne({
where: {
address,
user_id: user.id,
@@ -185,7 +185,7 @@ setInterval(async () => {
for (let i = 0; i < arr.length; i++) {
const hash = arr[i];
- let account, address, user, total;
+ let account, address, invoice, user, total;
await db.transaction(async transaction => {
let payments = await db.Payment.findAll({
where: { hash, confirmed: 0, received: 1 },
diff --git a/routes/lightning/parse.js b/routes/lightning/parse.js
index 4092d0f5..1b77019a 100644
--- a/routes/lightning/parse.js
+++ b/routes/lightning/parse.js
@@ -10,11 +10,10 @@ export default async (req, res) => {
if (!last || last > Date.now() - hour) ({ nodes } = await ln.listnodes());
store.nodes = nodes;
-
let twoWeeksAgo = new Date(new Date().setDate(new Date().getDate() - 14));
let { msatoshi, payee } = await ln.decodepay(payreq);
- let { alias } = nodes.find((n) => n.nodeid === payee);
- let route = await ln.getroute(payee, msatoshi, 5);
+ let node = nodes.find((n) => n.nodeid === payee);
+ let alias = node ? node.alias : payee.substr(0, 12);
- res.send({ alias, amount: Math.round(msatoshi / 1000), route });
+ res.send({ alias, amount: Math.round(msatoshi / 1000) });
};
diff --git a/routes/lnurl.js b/routes/lnurl.js
index 6ca61c93..683899b0 100644
--- a/routes/lnurl.js
+++ b/routes/lnurl.js
@@ -30,6 +30,8 @@ const recipients = persist("data/recipients.json");
const lnurlPayments = persist("data/payments.json");
const withdrawals = persist("data/withdrawals.json");
+const { HOSTNAME: hostname } = process.env;
+
export const lnurlServer = lnurl.createServer(config.lnurl);
app.get("/url", async (req, res, next) => {
@@ -226,7 +228,7 @@ app.post("/pay", auth, async (req, res, next) => {
memo: comment,
username: recipients[secret].username
},
- req.hostname,
+ hostname,
user
);
diff --git a/routes/send.js b/routes/send.js
index b57d8fc3..cc277850 100644
--- a/routes/send.js
+++ b/routes/send.js
@@ -3,7 +3,7 @@ import sendInternal from "$lib/sendInternal";
export default async (req, res, next) => {
try {
- let payment = await sendInternal(req.body, req.hostname, req.user);
+ let payment = await sendInternal(req.body, req.user);
res.send(payment);
} catch (e) {
err("problem sending internal payment", e.message);