import { switchToClusterFromEnv } from 'src/lib/cluster' ; import { execCmd } from 'src/lib/cmd-utils' ; import { AccountType , getAddressFromEnv } from 'src/lib/generate_utils' ; import { exitIfCelotoolHelmDryRun } from 'src/lib/helm_deploy' ; import { UpgradeArgv } from '../../deploy/upgrade' ; export const command = 'blockchain-api' ; export const describe = 'command for upgrading blockchain-api' ; type BlockchainApiArgv = UpgradeArgv ; export const handler = async ( argv ) => { exitIfCelotoolHelmDryRun ( ) ; await switchToClusterFromEnv ( argv . celoEnv ) ; const newFaucetAddress = getAddressFromEnv ( AccountType . VALIDATOR , 0 ) ; console . info ( `updating blockchain-api yaml file for env ${ argv . celoEnv }` ) ; await execCmd ( `sed -i.bak 's/FAUCET_ADDRESS: .*$/FAUCET_ADDRESS: \"${ newFaucetAddress }\"/g' ../blockchain-api/app.${ argv . celoEnv }.yaml` ) ; await execCmd ( `rm ../blockchain-api/app.${ argv . celoEnv }.yaml.bak` ) ; console . info ( `deploying blockchain-api for env ${ argv . config }` ) ; await execCmd ( `yarn --cwd ../blockchain-api run deploy -n ${ argv . celoEnv }` ) ; console . info ( `blockchain-api deploy complete` ) ; } ;