Skip to content

Commit

Permalink
test: fix verbose problem getting version in IT
Browse files Browse the repository at this point in the history
  • Loading branch information
aaitor committed Oct 6, 2023
1 parent 812a5d5 commit fb7c9f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions integration/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { makeAccounts, NeverminedOptions } from '@nevermined-io/sdk'
import { LoggerInstance, LogLevel, makeAccounts, NeverminedOptions } from '@nevermined-io/sdk'

LoggerInstance.setLevel(LogLevel.Error)

const logLevel = Number(process.env['LOG_LEVEL']) || 1 // warn by default

const configBase: NeverminedOptions = {
web3ProviderUri: 'http://contracts.nevermined.localnet',
Expand All @@ -9,10 +13,12 @@ const configBase: NeverminedOptions = {
artifactsFolder: './artifacts',
circuitsFolder: './circuits',
gasMultiplier: 1.1,
verbose: logLevel,
}

if (process.env.SEED_WORDS) {
configBase.accounts = makeAccounts(process.env.SEED_WORDS)
}

export const config: NeverminedOptions = configBase
export const config: NeverminedOptions & { forceVerbose: NeverminedOptions } = configBase as any
;(config as any).forceVerbose = { ...configBase, verbose: true }
7 changes: 3 additions & 4 deletions src/info/info.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import path from 'path'
import { Public } from '../common/decorators/auth.decorator'
import { Request } from '../common/helpers/request.interface'
import { GetInfoDto } from './dto/get-info.dto'
import { ContractHandler } from '@nevermined-io/sdk'
import { ethers } from 'ethers'
import NodeRSA from 'node-rsa'
import { NeverminedService } from '../shared/nevermined/nvm.service'
Expand All @@ -28,7 +27,7 @@ export class InfoController {
@Public()
async getInfo(@Req() req: Request<unknown>): Promise<GetInfoDto> {
const nevermined = this.nvmService.getNevermined()
const contractHandler = new ContractHandler(this.nvmService.instanceConfig())

const pathEndpoint = `${req.protocol}://${req.hostname}${
req.client.localPort ? `:${req.client.localPort}` : ''
}${req.url}`
Expand Down Expand Up @@ -57,7 +56,7 @@ export class InfoController {
(key) => contractInstances[key]?.address !== undefined,
)
const contracts = keys.map((key) => ({ [key]: contractInstances[key].address }))

nevermined.keeper.didRegistry.version
return {
APIversion: packageJson.version,
docs: `${pathEndpoint}api/v1/docs`,
Expand All @@ -68,7 +67,7 @@ export class InfoController {
'circuits-folder': circuitDir,
contracts: contracts,
'external-contracts': [],
'keeper-version': await contractHandler.getVersion('DIDRegistry', artifactDir),
'keeper-version': nevermined.keeper.didRegistry.version,
'provider-address': provider.getId(),
'ecdsa-public-key': wallet.signingKey.publicKey,
'rsa-public-key': key.exportKey('public'),
Expand Down
1 change: 1 addition & 0 deletions src/shared/nevermined/nvm.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class NeverminedService {
Logger.error(e)
throw new Error(`Invalid web3 provider for uri: ${config.web3ProviderUri}`)
}

this.nevermined = await Nevermined.getInstance(config)
const instanceConfig = {
...(await generateInstantiableConfigFromConfig(config)),
Expand Down

0 comments on commit fb7c9f1

Please sign in to comment.