dont access env variables directly

This commit is contained in:
g1nt0ki
2025-08-21 09:16:34 +02:00
parent 70c5b0ea01
commit 1dc1dd31b7
8 changed files with 31 additions and 55 deletions

View File

@@ -1,12 +1,11 @@
const sdk = require('@defillama/sdk')
const addressBook = require('../../projects/helper/bitcoin-book/index');
const { getEnv } = require('../../projects/helper/env');
const Bucket = "tvl-adapter-cache";
console.log('project count: ', Object.keys(addressBook).length);
const addressProjectMap = {}
const storeInR2 = !!process.env.STORE_IN_R2
const projectData = {}
async function run() {
@@ -20,7 +19,7 @@ async function run() {
if (!Array.isArray(addresses)) addresses = await addresses()
if (storeInR2) {
if (getEnv('STORE_IN_R2')) {
projectData[project] = addresses
return;
}
@@ -43,7 +42,7 @@ async function run() {
if (storeInR2) {
if (getEnv('STORE_IN_R2')) {
try {
await sdk.cache.writeCache(`${Bucket}/bitcoin-addresses.json`, projectData)
console.log('data written to s3 bucket');