Skip to content

Commit

Permalink
fix tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
code7551 committed Dec 20, 2023
1 parent 200b362 commit 2878221
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions apps/cli/src/node.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
import { getSignerFromPrivateKey, operatorRuntime } from "@sentry/core";
import axios from "axios";
const { FIREBASE_RTDB, FIREBASE_AUTH, SIGNER_PRIVATE_KEY } = process.env;
const { signer, address } = getSignerFromPrivateKey(SIGNER_PRIVATE_KEY);
const saveDB = (data: string, child = "") => {
console.log(data);
const dbURL = `${FIREBASE_RTDB}/${address.toLowerCase()}${child}.json?auth=${FIREBASE_AUTH}`;
axios
.put(dbURL, data, { headers: { "Content-Type": "application/json" } })
.catch((e) => {
console.log(e);
});
};
saveDB("inital...");
operatorRuntime(signer, undefined, (log: string) => {
saveDB(log.toString().replace(/\[(.*?)\]/, ""), `/${+new Date()}`);
});
interface ENVS extends NodeJS.ProcessEnv {
FIREBASE_RTDB?: string;
FIREBASE_AUTH?: string;
SIGNER_PRIVATE_KEY?: string;
}
const { FIREBASE_RTDB, FIREBASE_AUTH, SIGNER_PRIVATE_KEY }: ENVS = process.env;
if (FIREBASE_RTDB && FIREBASE_AUTH && SIGNER_PRIVATE_KEY)
{
const { signer, address } = getSignerFromPrivateKey(SIGNER_PRIVATE_KEY);
const saveDB = (data: string, child = "") => {
console.log(data);
const dbURL = `${FIREBASE_RTDB}/${address.toLowerCase()}${child}.json?auth=${FIREBASE_AUTH}`;
axios
.put(dbURL, data, { headers: { "Content-Type": "application/json" } })
.catch((e) => {
console.log(e);
});
};
saveDB("inital...");
operatorRuntime(signer, undefined, (log: string) => {
saveDB(log.toString().replace(/\[(.*?)\]/, ""), `/${+new Date()}`);
});
}
else
console.log("Missing ENVs")

0 comments on commit 2878221

Please sign in to comment.