Skip to content

Commit

Permalink
changing defaults to read dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorJTClarke committed Jul 19, 2022
1 parent c8b5712 commit 2297c28
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "croncat",
"version": "1.8.2",
"version": "1.8.3",
"description": "cron.cat CLI and Agent Runner",
"main": "src/index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/near.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "core-js/stable"
import "regenerator-runtime/runtime"
require('dotenv').config()
import { connect, KeyPair, keyStores, Contract, utils, WalletConnection, WalletAccount } from 'near-api-js'
// import fs from 'fs'
import path from 'path'
Expand All @@ -12,7 +13,7 @@ const credentialsBasePath = path.join(homedir(), CREDENTIALS_DIR)
class NearProvider {

constructor(options = {}) {
this.config = config.getConfig(options.networkId || 'testnet')
this.config = config.getConfig(options.networkId || process.env.NEAR_ENV || 'testnet')
this.credentials = null
this.client = null
this.accountId = null
Expand Down
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const atob = (base64) => {

// TODO: Multiple based on RPC providers
export const Near = new NearProvider({
networkId: config.NODE_ENV === 'production' ? 'mainnet' : config.NODE_ENV || 'testnet',
networkId: config.NODE_ENV === 'production' ? 'mainnet' : config.NEAR_ENV || process.env.NEAR_ENV || 'testnet',
accountId: config.AGENT_ACCOUNT_ID,
})
dbug('Near OBJ', Near);
Expand Down

0 comments on commit 2297c28

Please sign in to comment.