Skip to content

Commit

Permalink
Merge branch 'main' into feat/messageSorting
Browse files Browse the repository at this point in the history
  • Loading branch information
KolbyRKunz committed Feb 10, 2023
2 parents 77dfb7e + 1d487b1 commit f6c2583
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
TEST_AGENT_PUBLIC_DID_SEED: 000000000000000000000000Trustee9
GENESIS_TXN_PATH: network/genesis/local-genesis.txn
LIB_INDY_STRG_POSTGRES: /home/runner/work/aries-framework-javascript/indy-sdk/experimental/plugins/postgres_storage/target/release # for Linux
NODE_OPTIONS: --max_old_space_size=4096

# Make sure we're not running multiple release steps at the same time as this can give issues with determining the next npm version to release.
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case:
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/agent/AgentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import { DidCommMimeType } from '../types'

export class AgentConfig {
private initConfig: InitConfig
private _endpoints: string[] | undefined
public label: string
public logger: Logger
public readonly agentDependencies: AgentDependencies

public constructor(initConfig: InitConfig, agentDependencies: AgentDependencies) {
this.initConfig = initConfig
this._endpoints = initConfig.endpoints
this.label = initConfig.label
this.logger = initConfig.logger ?? new ConsoleLogger(LogLevel.off)
this.agentDependencies = agentDependencies
Expand Down Expand Up @@ -134,11 +136,15 @@ export class AgentConfig {
public get endpoints(): [string, ...string[]] {
// if endpoints is not set, return queue endpoint
// https://github.com/hyperledger/aries-rfcs/issues/405#issuecomment-582612875
if (!this.initConfig.endpoints || this.initConfig.endpoints.length === 0) {
if (!this._endpoints || this._endpoints.length === 0) {
return [DID_COMM_TRANSPORT_QUEUE]
}

return this.initConfig.endpoints as [string, ...string[]]
return this._endpoints as [string, ...string[]]
}

public set endpoints(endpoints: string[]) {
this._endpoints = endpoints
}

/**
Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/agent/__tests__/AgentConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ describe('AgentConfig', () => {

expect(agentConfig.endpoints).toStrictEqual(['didcomm:transport/queue'])
})

it('should return the new config endpoint after setter is called', () => {
const endpoint = 'https://local-url.com'
const newEndpoint = 'https://new-local-url.com'

const agentConfig = getAgentConfig('AgentConfig Test', {
endpoints: [endpoint],
})

agentConfig.endpoints = [newEndpoint]
expect(agentConfig.endpoints).toEqual([newEndpoint])
})
})

describe('label', () => {
Expand Down

0 comments on commit f6c2583

Please sign in to comment.