Skip to content

Commit

Permalink
fix using custom address file
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcos20 committed Feb 5, 2024
1 parent a0964d5 commit 9092ede
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/config/ConfigHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// eslint-disable-next-line import/no-named-default
import { default as DefaultContractsAddresses } from '@oceanprotocol/contracts/addresses/address.json'
import fs from 'fs'
import { Config } from '.'
import { LoggerInstance } from '../utils'

Expand Down Expand Up @@ -261,8 +262,14 @@ export class ConfigHelper {

let addresses
try {
addresses = JSON.parse(process.env.ADDRESS_FILE)
addresses = process.env.ADDRESS_FILE
? JSON.parse(
// eslint-disable-next-line security/detect-non-literal-fs-filename
fs.readFileSync(process.env.ADDRESS_FILE, 'utf8')
)
: null
} catch (e) {
console.log(e)
addresses = null
}
const contractAddressesConfig = this.getAddressesFromEnv(config.network, addresses)
Expand Down

0 comments on commit 9092ede

Please sign in to comment.