From 0b4ce6064f2a6ed374688b4dcbba314301a558bb Mon Sep 17 00:00:00 2001 From: golobitch Date: Tue, 21 May 2024 21:12:05 +0200 Subject: [PATCH 01/15] feat(backend)!: update env variables --- packages/backend/jest.config.js | 1 + packages/backend/jest.env.js | 9 ++++ packages/backend/src/config/app.ts | 72 +++++++++++++++--------------- 3 files changed, 46 insertions(+), 36 deletions(-) create mode 100644 packages/backend/jest.env.js diff --git a/packages/backend/jest.config.js b/packages/backend/jest.config.js index 8f933f9a4c..127e2dba99 100644 --- a/packages/backend/jest.config.js +++ b/packages/backend/jest.config.js @@ -25,6 +25,7 @@ module.exports = { `/packages/${packageName}/src/`, `/node_modules` ], + setupFiles: [`/packages/${packageName}/jest.env.js`], id: packageName, displayName: packageName, rootDir: '../..' diff --git a/packages/backend/jest.env.js b/packages/backend/jest.env.js new file mode 100644 index 0000000000..dd60c312b2 --- /dev/null +++ b/packages/backend/jest.env.js @@ -0,0 +1,9 @@ +process.env.INSTANCE_NAME = 'Rafiki' +process.env.KEY_ID = 'myKey' +process.env.OPEN_PAYMENTS_URL = 'http://127.0.0.1:3000' +process.env.ILP_CONNECTOR_ADDRESS = 'http://127.0.0.1:3002' +process.env.ILP_ADDRESS = 'test.rafiki' +process.env.AUTH_SERVER_GRANT_URL = 'http://127.0.0.1:3006' +process.env.AUTH_SERVER_INTROSPECTION_URL = 'http://127.0.0.1:3007/' +process.env.WEBHOOK_URL = 'http://127.0.0.1:4001/webhook' +process.env.STREAM_SECRET = '2/PxuRFV9PAp0yJlnAifJ+1OxujjjI16lN+DBnLNRLA=' diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index ee2711c931..01dc103b68 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -1,12 +1,15 @@ import { loadOrGenerateKey } from '@interledger/http-signature-utils' -import * as crypto from 'crypto' import dotenv from 'dotenv' import * as fs from 'fs' import { ConnectionOptions } from 'tls' -function envString(name: string, value: string): string { +function envString(name: string, defaultValue?: string): string { const envValue = process.env[name] - return envValue == null ? value : envValue + + if (envValue) return envValue + if (defaultValue) return defaultValue + + throw new Error(`Environment variable ${name} must be set.`) } function envStringArray(name: string, value: string[]): string[] { @@ -35,9 +38,18 @@ dotenv.config({ path: process.env.ENV_FILE || '.env' }) +let privateKeyFileEnv +try { + privateKeyFileEnv = envString('PRIVATE_KEY_FILE') +} catch (err) { + /* empty */ +} + +const privateKeyFileValue = loadOrGenerateKey(privateKeyFileEnv) + export const Config = { logLevel: envString('LOG_LEVEL', 'info'), - enableTelemetry: envBool('ENABLE_TELEMETRY', true), + enableTelemetry: envBool('ENABLE_TELEMETRY', false), livenet: envBool('LIVENET', false), openTelemetryCollectors: envStringArray( 'OPEN_TELEMETRY_COLLECTOR_URLS', @@ -59,7 +71,7 @@ export const Config = { 86_400_000 ), adminPort: envInt('ADMIN_PORT', 3001), - openPaymentsUrl: envString('OPEN_PAYMENTS_URL', 'http://127.0.0.1:3000'), + openPaymentsUrl: envString('OPEN_PAYMENTS_URL'), openPaymentsPort: envInt('OPEN_PAYMENTS_PORT', 3003), connectorPort: envInt('CONNECTOR_PORT', 3002), autoPeeringServerPort: envInt('AUTO_PEERING_SERVER_PORT', 3005), @@ -80,21 +92,15 @@ export const Config = { trustProxy: envBool('TRUST_PROXY', false), redisUrl: envString('REDIS_URL', 'redis://127.0.0.1:6379'), redisTls: parseRedisTlsConfig( - envString('REDIS_TLS_CA_FILE_PATH', ''), - envString('REDIS_TLS_KEY_FILE_PATH', ''), - envString('REDIS_TLS_CERT_FILE_PATH', '') + process.env.REDIS_TLS_CA_FILE_PATH, + process.env.REDIS_TLS_KEY_FILE_PATH, + process.env.REDIS_TLS_CERT_FILE_PATH ), - ilpAddress: envString('ILP_ADDRESS', 'test.rafiki'), - ilpConnectorAddress: envString( - 'ILP_CONNECTOR_ADDRESS', - 'http://127.0.0.1:3002' - ), - instanceName: envString('INSTANCE_NAME', 'Rafiki'), - streamSecret: process.env.STREAM_SECRET - ? Buffer.from(process.env.STREAM_SECRET, 'base64') - : crypto.randomBytes(32), - - useTigerbeetle: envBool('USE_TIGERBEETLE', false), + ilpAddress: envString('ILP_ADDRESS'), + ilpConnectorAddress: envString('ILP_CONNECTOR_ADDRESS'), + instanceName: envString('INSTANCE_NAME'), + streamSecret: Buffer.from(process.env.STREAM_SECRET || '', 'base64'), + useTigerbeetle: envBool('USE_TIGERBEETLE', true), tigerbeetleClusterId: envInt('TIGERBEETLE_CLUSTER_ID', 0), tigerbeetleReplicaAddresses: process.env.TIGERBEETLE_REPLICA_ADDRESSES ? process.env.TIGERBEETLE_REPLICA_ADDRESSES.split(',') @@ -109,14 +115,8 @@ export const Config = { walletAddressWorkers: envInt('WALLET_ADDRESS_WORKERS', 1), walletAddressWorkerIdle: envInt('WALLET_ADDRESS_WORKER_IDLE', 200), // milliseconds - authServerGrantUrl: envString( - 'AUTH_SERVER_GRANT_URL', - 'http://127.0.0.1:3006' - ), - authServerIntrospectionUrl: envString( - 'AUTH_SERVER_INTROSPECTION_URL', - 'http://127.0.0.1:3007/' - ), + authServerGrantUrl: envString('AUTH_SERVER_GRANT_URL'), + authServerIntrospectionUrl: envString('AUTH_SERVER_INTROSPECTION_URL'), outgoingPaymentWorkers: envInt('OUTGOING_PAYMENT_WORKERS', 4), outgoingPaymentWorkerIdle: envInt('OUTGOING_PAYMENT_WORKER_IDLE', 200), // milliseconds @@ -126,7 +126,7 @@ export const Config = { webhookWorkers: envInt('WEBHOOK_WORKERS', 1), webhookWorkerIdle: envInt('WEBHOOK_WORKER_IDLE', 200), // milliseconds - webhookUrl: envString('WEBHOOK_URL', 'http://127.0.0.1:4001/webhook'), + webhookUrl: envString('WEBHOOK_URL'), webhookTimeout: envInt('WEBHOOK_TIMEOUT', 2000), // milliseconds webhookMaxRetry: envInt('WEBHOOK_MAX_RETRY', 10), @@ -142,8 +142,8 @@ export const Config = { adminApiSignatureVersion: envInt('API_SIGNATURE_VERSION', 1), adminApiSignatureTtl: envInt('ADMIN_API_SIGNATURE_TTL_SECONDS', 30), - keyId: envString('KEY_ID', 'rafiki'), - privateKey: loadOrGenerateKey(envString('PRIVATE_KEY_FILE', '')), + keyId: envString('KEY_ID'), + privateKey: privateKeyFileValue, graphQLIdempotencyKeyLockMs: envInt('GRAPHQL_IDEMPOTENCY_KEY_LOCK_MS', 2000), graphQLIdempotencyKeyTtlMs: envInt( @@ -170,23 +170,23 @@ export const Config = { } function parseRedisTlsConfig( - caFile: string, - keyFile: string, - certFile: string + caFile?: string, + keyFile?: string, + certFile?: string ): ConnectionOptions | undefined { const options: ConnectionOptions = {} // self-signed certs. - if (caFile !== '') { + if (caFile) { options.ca = fs.readFileSync(caFile) options.rejectUnauthorized = false } - if (certFile !== '') { + if (certFile) { options.cert = fs.readFileSync(certFile) } - if (keyFile !== '') { + if (keyFile) { options.key = fs.readFileSync(keyFile) } From f98f648b8453c14de8697d162effd54a5d1b9d88 Mon Sep 17 00:00:00 2001 From: golobitch Date: Wed, 22 May 2024 21:42:53 +0200 Subject: [PATCH 02/15] feat(localenv): update backend env variables --- localenv/cloud-nine-wallet/docker-compose.yml | 3 ++- localenv/happy-life-bank/docker-compose.yml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/localenv/cloud-nine-wallet/docker-compose.yml b/localenv/cloud-nine-wallet/docker-compose.yml index 93aec29a01..012437d5b9 100644 --- a/localenv/cloud-nine-wallet/docker-compose.yml +++ b/localenv/cloud-nine-wallet/docker-compose.yml @@ -72,8 +72,9 @@ services: EXCHANGE_RATES_URL: http://cloud-nine-wallet/rates REDIS_URL: redis://shared-redis:6379/0 WALLET_ADDRESS_URL: ${CLOUD_NINE_WALLET_ADDRESS_URL:-https://cloud-nine-wallet-backend/.well-known/pay} - ILP_CONNECTOR_ADDRESS: ${CLOUD_NINE_CONNECTOR_URL} + ILP_CONNECTOR_ADDRESS: http://127.0.0.1:3002 ENABLE_TELEMETRY: false + KEY_ID: rafiki depends_on: - shared-database - shared-redis diff --git a/localenv/happy-life-bank/docker-compose.yml b/localenv/happy-life-bank/docker-compose.yml index 4fb4bb0ef0..3ee9c74374 100644 --- a/localenv/happy-life-bank/docker-compose.yml +++ b/localenv/happy-life-bank/docker-compose.yml @@ -41,6 +41,7 @@ services: ports: - "4000:80" - "4001:3001" + - "4002:3002" - '9231:9229' networks: - rafiki @@ -58,6 +59,7 @@ services: AUTH_SERVER_GRANT_URL: ${HAPPY_LIFE_BANK_AUTH_SERVER_DOMAIN:-http://happy-life-bank-auth:3006} AUTH_SERVER_INTROSPECTION_URL: http://happy-life-bank-auth:3007 ILP_ADDRESS: test.happy-life-bank + ILP_CONNECTOR_ADDRESS: http://127.0.0.1:4002 STREAM_SECRET: BjPXtnd00G2mRQwP/8ZpwyZASOch5sUXT5o0iR5b5wU= API_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964= WEBHOOK_URL: http://happy-life-bank/webhooks @@ -66,6 +68,7 @@ services: REDIS_URL: redis://shared-redis:6379/2 WALLET_ADDRESS_URL: ${HAPPY_LIFE_BANK_WALLET_ADDRESS_URL:-https://happy-life-bank-backend/.well-known/pay} ENABLE_TELEMETRY: false + KEY_ID: rafiki depends_on: - cloud-nine-backend happy-life-auth: From 35982cbb86d75ca347a990c9250c50abd0df3b54 Mon Sep 17 00:00:00 2001 From: golobitch Date: Wed, 22 May 2024 21:43:12 +0200 Subject: [PATCH 03/15] test(integration): update backend env variables --- test/integration/testenv/cloud-nine-wallet/docker-compose.yml | 2 ++ test/integration/testenv/happy-life-bank/docker-compose.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml index cd42756e39..1ac83a8397 100644 --- a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml +++ b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml @@ -19,6 +19,7 @@ services: environment: LOG_LEVEL: debug NODE_ENV: development + INSTANCE_NAME: 'Rafiki' CONNECTOR_PORT: 3102 ADMIN_PORT: 3101 OPEN_PAYMENTS_PORT: 3100 @@ -31,6 +32,7 @@ services: AUTH_SERVER_INTROSPECTION_URL: http://cloud-nine-wallet-test-auth:3107 AUTH_SERVER_GRANT_URL: http://cloud-nine-wallet-test-auth:3106 ILP_ADDRESS: test.cloud-nine-wallet-test + ILP_CONNECTOR_ADDRESS: http://127.0.0.1:3102 STREAM_SECRET: BjPXtnd00G2mRQwP/8ZpwyZASOch5sUXT5o0iR5b5wU= WEBHOOK_URL: http://host.docker.internal:8888/webhooks EXCHANGE_RATES_URL: http://host.docker.internal:8888/rates diff --git a/test/integration/testenv/happy-life-bank/docker-compose.yml b/test/integration/testenv/happy-life-bank/docker-compose.yml index 09121fa9b2..5e72ebaebb 100644 --- a/test/integration/testenv/happy-life-bank/docker-compose.yml +++ b/test/integration/testenv/happy-life-bank/docker-compose.yml @@ -17,6 +17,7 @@ services: environment: NODE_ENV: development LOG_LEVEL: debug + INSTANCE_NAME: 'Happy Life Test' OPEN_PAYMENTS_URL: https://happy-life-bank-test-backend:4100 WALLET_ADDRESS_URL: https://happy-life-bank-test-backend:4100/.well-known/pay ADMIN_PORT: 4101 @@ -29,6 +30,7 @@ services: KEY_ID: keyid-97a3a431-8ee1-48fc-ac85-70e2f5eba8e5 PRIVATE_KEY_FILE: /workspace/private-key.pem ILP_ADDRESS: test.happy-life-bank-test + ILP_CONNECTOR_ADDRESS: http://127.0.0.1:4102 STREAM_SECRET: BjPXtnd00G2mRQwP/8ZpwyZASOch5sUXT5o0iR5b5wU= WEBHOOK_URL: http://host.docker.internal:8889/webhooks EXCHANGE_RATES_URL: http://host.docker.internal:8889/rates From 4eb7221811fda3c084c47e484e78f7427e89a591 Mon Sep 17 00:00:00 2001 From: golobitch Date: Tue, 28 May 2024 11:34:50 +0200 Subject: [PATCH 04/15] feat(backend)!: rename SPS_ENABLE env variable --- packages/backend/src/app.ts | 2 +- packages/backend/src/config/app.ts | 2 +- .../src/payment-method/ilp/spsp/middleware.test.ts | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/app.ts b/packages/backend/src/app.ts index a6a2c642c3..918e93edda 100644 --- a/packages/backend/src/app.ts +++ b/packages/backend/src/app.ts @@ -661,7 +661,7 @@ export class App { router.get( WALLET_ADDRESS_PATH, getWalletAddressUrlFromPath, - createSpspMiddleware(this.config.spspEnabled), + createSpspMiddleware(this.config.enableInterledgerPaymentPointers), createValidatorMiddleware( walletAddressServerSpec, { diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index 01dc103b68..e81be9d3d4 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -166,7 +166,7 @@ export const Config = { 'INCOMING_PAYMENT_EXPIRY_MAX_MS', 2592000000 ), // 30 days - spspEnabled: envBool('ENABLE_SPSP', true) + enableInterledgerPaymentPointers: envBool('ENABLE_INTERLEDGER_PAYMENT_POINTERS', true) } function parseRedisTlsConfig( diff --git a/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts b/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts index 4a70a5fcd9..86057c5f2a 100644 --- a/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts +++ b/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts @@ -56,7 +56,7 @@ describe('SPSP Middleware', (): void => { }) test.each` - header | spspEnabled | description + header | enableInterledgerPaymentPointers | description ${'application/json'} | ${true} | ${'calls next'} ${'application/json'} | ${false} | ${'calls next'} ${'application/spsp4+json'} | ${true} | ${'calls SPSP route'} @@ -64,16 +64,16 @@ describe('SPSP Middleware', (): void => { ${'*/*'} | ${true} | ${'calls next'} ${'*/*'} | ${false} | ${'calls next'} `( - '$description for accept header: $header and spspEnabled: $spspEnabled', - async ({ header, spspEnabled }): Promise => { + '$description for accept header: $header and enableInterledgerPaymentPointers: $enableInterledgerPaymentPointers', + async ({ header, enableInterledgerPaymentPointers }): Promise => { const spspSpy = jest .spyOn(spspRoutes, 'get') .mockResolvedValueOnce(undefined) ctx.headers['accept'] = header - const spspMiddleware = createSpspMiddleware(spspEnabled) + const spspMiddleware = createSpspMiddleware(enableInterledgerPaymentPointers) await expect(spspMiddleware(ctx, next)).resolves.toBeUndefined() - if (spspEnabled && header == 'application/spsp4+json') { + if (enableInterledgerPaymentPointers && header == 'application/spsp4+json') { expect(spspSpy).toHaveBeenCalledTimes(1) expect(next).not.toHaveBeenCalled() expect(ctx.paymentTag).toEqual(walletAddress.id) From 98b0b336f963a058933406aea14f239c09bbd6a5 Mon Sep 17 00:00:00 2001 From: golobitch Date: Tue, 28 May 2024 12:49:21 +0200 Subject: [PATCH 05/15] test(integration): update backend env variables --- packages/backend/jest.config.js | 12 ++++++++++- packages/backend/jest.env.js | 9 -------- packages/backend/src/config/app.ts | 5 ++++- .../ilp/spsp/middleware.test.ts | 21 ++++++++++++------- .../cloud-nine-wallet/docker-compose.yml | 1 + .../happy-life-bank/docker-compose.yml | 1 + 6 files changed, 30 insertions(+), 19 deletions(-) delete mode 100644 packages/backend/jest.env.js diff --git a/packages/backend/jest.config.js b/packages/backend/jest.config.js index 127e2dba99..c1b70622ca 100644 --- a/packages/backend/jest.config.js +++ b/packages/backend/jest.config.js @@ -5,6 +5,17 @@ const baseConfig = require('../../jest.config.base.js') const packageName = require('./package.json').name process.env.LOG_LEVEL = 'silent' +process.env.INSTANCE_NAME = 'Rafiki' +process.env.KEY_ID = 'myKey' +process.env.OPEN_PAYMENTS_URL = 'http://127.0.0.1:3000' +process.env.ILP_CONNECTOR_ADDRESS = 'http://127.0.0.1:3002' +process.env.ILP_ADDRESS = 'test.rafiki' +process.env.AUTH_SERVER_GRANT_URL = 'http://127.0.0.1:3006' +process.env.AUTH_SERVER_INTROSPECTION_URL = 'http://127.0.0.1:3007/' +process.env.WEBHOOK_URL = 'http://127.0.0.1:4001/webhook' +process.env.STREAM_SECRET = '2/PxuRFV9PAp0yJlnAifJ+1OxujjjI16lN+DBnLNRLA=' +process.env.USE_TIGERBEETLE = false +process.env.ENABLE_TELEMETRY = false module.exports = { ...baseConfig, @@ -25,7 +36,6 @@ module.exports = { `/packages/${packageName}/src/`, `/node_modules` ], - setupFiles: [`/packages/${packageName}/jest.env.js`], id: packageName, displayName: packageName, rootDir: '../..' diff --git a/packages/backend/jest.env.js b/packages/backend/jest.env.js deleted file mode 100644 index dd60c312b2..0000000000 --- a/packages/backend/jest.env.js +++ /dev/null @@ -1,9 +0,0 @@ -process.env.INSTANCE_NAME = 'Rafiki' -process.env.KEY_ID = 'myKey' -process.env.OPEN_PAYMENTS_URL = 'http://127.0.0.1:3000' -process.env.ILP_CONNECTOR_ADDRESS = 'http://127.0.0.1:3002' -process.env.ILP_ADDRESS = 'test.rafiki' -process.env.AUTH_SERVER_GRANT_URL = 'http://127.0.0.1:3006' -process.env.AUTH_SERVER_INTROSPECTION_URL = 'http://127.0.0.1:3007/' -process.env.WEBHOOK_URL = 'http://127.0.0.1:4001/webhook' -process.env.STREAM_SECRET = '2/PxuRFV9PAp0yJlnAifJ+1OxujjjI16lN+DBnLNRLA=' diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index e81be9d3d4..5d9d514f87 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -166,7 +166,10 @@ export const Config = { 'INCOMING_PAYMENT_EXPIRY_MAX_MS', 2592000000 ), // 30 days - enableInterledgerPaymentPointers: envBool('ENABLE_INTERLEDGER_PAYMENT_POINTERS', true) + enableInterledgerPaymentPointers: envBool( + 'ENABLE_INTERLEDGER_PAYMENT_POINTERS', + true + ) } function parseRedisTlsConfig( diff --git a/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts b/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts index 86057c5f2a..0c89f248f7 100644 --- a/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts +++ b/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts @@ -57,12 +57,12 @@ describe('SPSP Middleware', (): void => { test.each` header | enableInterledgerPaymentPointers | description - ${'application/json'} | ${true} | ${'calls next'} - ${'application/json'} | ${false} | ${'calls next'} - ${'application/spsp4+json'} | ${true} | ${'calls SPSP route'} - ${'application/spsp4+json'} | ${false} | ${'calls next'} - ${'*/*'} | ${true} | ${'calls next'} - ${'*/*'} | ${false} | ${'calls next'} + ${'application/json'} | ${true} | ${'calls next'} + ${'application/json'} | ${false} | ${'calls next'} + ${'application/spsp4+json'} | ${true} | ${'calls SPSP route'} + ${'application/spsp4+json'} | ${false} | ${'calls next'} + ${'*/*'} | ${true} | ${'calls next'} + ${'*/*'} | ${false} | ${'calls next'} `( '$description for accept header: $header and enableInterledgerPaymentPointers: $enableInterledgerPaymentPointers', async ({ header, enableInterledgerPaymentPointers }): Promise => { @@ -70,10 +70,15 @@ describe('SPSP Middleware', (): void => { .spyOn(spspRoutes, 'get') .mockResolvedValueOnce(undefined) ctx.headers['accept'] = header - const spspMiddleware = createSpspMiddleware(enableInterledgerPaymentPointers) + const spspMiddleware = createSpspMiddleware( + enableInterledgerPaymentPointers + ) await expect(spspMiddleware(ctx, next)).resolves.toBeUndefined() - if (enableInterledgerPaymentPointers && header == 'application/spsp4+json') { + if ( + enableInterledgerPaymentPointers && + header == 'application/spsp4+json' + ) { expect(spspSpy).toHaveBeenCalledTimes(1) expect(next).not.toHaveBeenCalled() expect(ctx.paymentTag).toEqual(walletAddress.id) diff --git a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml index 1ac83a8397..934cd14099 100644 --- a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml +++ b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml @@ -37,6 +37,7 @@ services: WEBHOOK_URL: http://host.docker.internal:8888/webhooks EXCHANGE_RATES_URL: http://host.docker.internal:8888/rates REDIS_URL: redis://shared-redis:6379/0 + USE_TIGERBEETLE: false volumes: - ../private-key.pem:/workspace/private-key.pem depends_on: diff --git a/test/integration/testenv/happy-life-bank/docker-compose.yml b/test/integration/testenv/happy-life-bank/docker-compose.yml index 5e72ebaebb..aa76735b34 100644 --- a/test/integration/testenv/happy-life-bank/docker-compose.yml +++ b/test/integration/testenv/happy-life-bank/docker-compose.yml @@ -35,6 +35,7 @@ services: WEBHOOK_URL: http://host.docker.internal:8889/webhooks EXCHANGE_RATES_URL: http://host.docker.internal:8889/rates REDIS_URL: redis://shared-redis:6379/2 + USE_TIGERBEETLE: false volumes: - ../private-key.pem:/workspace/private-key.pem depends_on: From 5a9eda8474f5242e7e6f21b65d80f871f795a014 Mon Sep 17 00:00:00 2001 From: golobitch Date: Fri, 7 Jun 2024 21:20:30 +0200 Subject: [PATCH 06/15] fix(telemetry): shutdown only if enabled in config --- packages/backend/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 346e9bb277..bf7c82be33 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -511,9 +511,9 @@ export const gracefulShutdown = async ( await redis.quit() redis.disconnect() - const telemetry = await container.use('telemetry') - if (telemetry) { - await telemetry.shutdown() + if (config.enableTelemetry) { + const telemetry = await container.use('telemetry') + telemetry?.shutdown() } } From 6f249f1311e00eb23175c281a2201bc775ccfb46 Mon Sep 17 00:00:00 2001 From: golobitch Date: Fri, 7 Jun 2024 21:38:30 +0200 Subject: [PATCH 07/15] docs(integration): update env variables default values --- .../content/docs/integration/deployment.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/documentation/src/content/docs/integration/deployment.md b/packages/documentation/src/content/docs/integration/deployment.md index cb032692f1..b170d1b024 100644 --- a/packages/documentation/src/content/docs/integration/deployment.md +++ b/packages/documentation/src/content/docs/integration/deployment.md @@ -55,28 +55,28 @@ Now, the Admin UI can be found on localhost:3010. | Variable | Helm Value Name | Default | Description | | ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ADMIN_PORT` | backend.port.admin | `3001` | Admin API GraphQL Server port | -| `AUTH_SERVER_GRANT_URL` | | `http://127.0.0.1:3006` | endpoint on the Open Payments Auth Server to request a grant | -| `AUTH_SERVER_INTROSPECTION_URL` | | `http://127.0.0.1:3007` | endpoint on the Open Payments Auth Server to introspect an access token | +| `AUTH_SERVER_GRANT_URL` | | `undefined` | endpoint on the Open Payments Auth Server to request a grant | +| `AUTH_SERVER_INTROSPECTION_URL` | | `undefined` | endpoint on the Open Payments Auth Server to introspect an access token | | `AUTO_PEERING_SERVER_PORT` | | `3005` | If [auto-peering](/concepts/interledger-protocol/peering#auto-peering) is enabled, its server will use this port | | `CONNECTOR_PORT` | backend.port.connector | `3002` | port of the ILP connector for for sending packets over ILP over HTTP | | `DATABASE_URL` | backend.postgresql.host, backend.postgresql.port, backend.postgresql.username, backend.postgresql.database, backend.postgresql.password | `postgresql://postgres:password@localhost:5432/development` | Postgres database URL of database storing the resource data; For Helm, these components are provided individually. | | `ENABLE_AUTO_PEERING` | | `false` | Flag to enable auto peering. View [documentation](/concepts/interledger-protocol/peering#auto-peering). | -| `ENABLE_SPSP` | | `true` | enables [SPSP](/reference/glossary#simple-payments-setup-protocol-spsp) route | +| `ENABLE_INTERLEDGER_PAYMENT_POINTERS` | | `true` | enables [SPSP](/reference/glossary#simple-payments-setup-protocol-spsp) route | | `EXCHANGE_RATES_LIFETIME` | backend.lifetime.exchangeRate | `15_000` | time in milliseconds the exchange rates provided by the ASE via the EXCHANGE_RATES_URL are valid for | | `EXCHANGE_RATES_URL` | backend.serviceUrls.EXCHANGE_RATES_URL | `undefined` | endpoint on the Account Servicing Entity to request exchange rates | | `GRAPHQL_IDEMPOTENCY_KEY_TTL_MS` | backend.idempotencyTTL | `86400000` | TTL in milliseconds for idempotencyKey on GraphQL mutations (Admin API). Default: 24hrs | | `GRAPHQL_IDEMPOTENCY_KEY_LOCK_MS` | | `2000` | TTL in milliseconds for idempotencyKey concurrency lock on GraphQL mutations (Admin API) | -| `ILP_ADDRESS` | backend.ilp.address | `test.rafiki` | ILP address of this Rafiki instance | -| `ILP_CONNECTOR_ADDRESS` | | `http://127.0.0.1:3002` | The ILP connector address where ILP packets are received. Communicated during [auto-peering](/concepts/interledger-protocol/peering#auto-peering) | +| `ILP_ADDRESS` | backend.ilp.address | `undefined` | ILP address of this Rafiki instance | +| `ILP_CONNECTOR_ADDRESS` | | `undefined` | The ILP connector address where ILP packets are received. Communicated during [auto-peering](/concepts/interledger-protocol/peering#auto-peering) | | `INCOMING_PAYMENT_EXPIRY_MAX_MS` | | `2592000000` | Maximum milliseconds into the future incoming payments expiry can be set to on creation. Default: 30 days | | `INCOMING_PAYMENT_WORKERS` | backend.workers.incomingPayment | `1` | number of workers processing incoming payment requests | | `INCOMING_PAYMENT_WORKER_IDLE` | backend.workerIdle | `200` | time in milliseconds that INCOMING_PAYMENT_WORKERS will wait until they check an empty incoming payment request queue again | -| `INSTANCE_NAME` | | `Rafiki` | this Rafiki instance's name used to communicate for [auto-peering](/concepts/interledger-protocol/peering#auto-peering) | -| `KEY_ID` | backend.key.id | `rafiki` | this Rafiki instance's client key id | +| `INSTANCE_NAME` | | `undefined` | this Rafiki instance's name used to communicate for [auto-peering](/concepts/interledger-protocol/peering#auto-peering) | +| `KEY_ID` | backend.key.id | `undefined` | this Rafiki instance's client key id | | `LOG_LEVEL` | backend.logLevel | `info` | [Pino Log Level](https://getpino.io/#/docs/api?id=levels) | | `NODE_ENV` | backend.nodeEnv | `development` | node environment, `development`, `test`, or `production` | | `OPEN_PAYMENTS_PORT` | backend.port.openPayments | `3003` | port of the Open Payments resource server port | -| `OPEN_PAYMENTS_URL` | backend.serviceUrls.OPEN_PAYMENTS_URL | `http://127.0.0.1:3003` | public endpoint of this Open Payments Resource Server | +| `OPEN_PAYMENTS_URL` | backend.serviceUrls.OPEN_PAYMENTS_URL | `undefined` | public endpoint of this Open Payments Resource Server | | `OUTGOING_PAYMENT_WORKERS` | backend.workers.outgoingPayment | `4` | number of workers processing outgoing payment requests | | `OUTGOING_PAYMENT_WORKER_IDLE` | backend.workerIdle | `200` | time in milliseconds that OUTGOING_PAYMENT_WORKERS will wait until they check an empty outgoing payment request queue again | | `PRIVATE_KEY_FILE` | backend.key.file | `undefined` | the path to this Rafiki instance's client private key | @@ -88,11 +88,11 @@ Now, the Admin UI can be found on localhost:3010. | `SIGNATURE_SECRET` | backend.quoteSignatureSecret | `undefined` | secret to generate request header signatures for webhook event requests | | `SIGNATURE_VERSION` | | `1` | version number to generate request header signatures for webhook event requests | | `SLIPPAGE` | backend.ilp.slippage | `0.01` | accepted ILP rate fluctuation, default 1% | -| `STREAM_SECRET` | backend.ilp.streamSecret | 32 random bytes | seed secret to generate shared STREAM secrets | +| `STREAM_SECRET` | backend.ilp.streamSecret | undefined | seed secret to generate shared STREAM secrets | | `TIGERBEETLE_CLUSTER_ID` | | `0` | Tigerbeetle cluster ID picked by the system that starts the TigerBeetle cluster to create a [Tigerbeetle client](https://docs.tigerbeetle.com/clients/node#creating-a-client) | | `TIGERBEETLE_REPLICA_ADDRESSES` | | `3004` | Tigerbeetle replica addresses for all replicas in the cluster, which are comma separated IP addresses/ports, to create a [Tigerbeetle client](https://docs.tigerbeetle.com/clients/node#creating-a-client) | | `TRUST_PROXY` | | `false` | flag to use X-Forwarded-Proto header to determine if connections is secure | -| `USE_TIGERBEETLE` | | `false` | flag - use TigerBeetle or Postgres for accounting | +| `USE_TIGERBEETLE` | | `true` | flag - use TigerBeetle or Postgres for accounting | | `WALLET_ADDRESS_DEACTIVATION_PAYMENT_GRACE_PERIOD_MS` | | `86400000` | time in milliseconds into the future to set expiration of open incoming payments when deactivating wallet address. Default: 1 days | | `WALLET_ADDRESS_LOOKUP_TIMEOUT_MS` | | `1500` | time in milliseconds the ASE has to create a missing wallet address until timeout | | `WALLET_ADDRESS_POLLING_FREQUENCY_MS` | | `100` | frequency of polling while waiting for ASE to create a missing wallet address | @@ -101,7 +101,7 @@ Now, the Admin UI can be found on localhost:3010. | `WALLET_ADDRESS_WORKER_IDLE` | backend.workerIdle | `200` | time in milliseconds that WALLET_ADDRESS_WORKERS will wait until they check an empty wallet address request queue again | | `WEBHOOK_MAX_RETRY` | backend.webhookMaxRetry | `10` | maximum number of times Rafiki backend retries sending a certain webhook event to the configured WEBHOOK_URL | | `WEBHOOK_TIMEOUT` | backend.lifetime.webhook | `2000` | milliseconds | -| `WEBHOOK_URL` | backend.serviceUrls.WEBHOOK_URL | `http://127.0.0.1:4001/webhook` | endpoint on the Account Servicing Entity that consumes webhook events | +| `WEBHOOK_URL` | backend.serviceUrls.WEBHOOK_URL | `undefined` | endpoint on the Account Servicing Entity that consumes webhook events | | `WEBHOOK_WORKERS` | backend.workers.webhook | `1` | number of workers processing webhook events | | `WEBHOOK_WORKER_IDLE` | backend.workerIdle | `200` | time in milliseconds that WEBHOOK_WORKERS will wait until they check an empty webhook event queue again | | `WITHDRAWAL_THROTTLE_DELAY` | backend.withdrawalThrottleDelay | `undefined` | delay in liquidity withdrawal processing | From 9bb52658005f39141be641a75c515d0cfd909718 Mon Sep 17 00:00:00 2001 From: golobitch Date: Sat, 8 Jun 2024 13:30:23 +0200 Subject: [PATCH 08/15] feat(localenv): enable telemetry --- localenv/cloud-nine-wallet/docker-compose.yml | 2 +- localenv/happy-life-bank/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/localenv/cloud-nine-wallet/docker-compose.yml b/localenv/cloud-nine-wallet/docker-compose.yml index 012437d5b9..4ced035e18 100644 --- a/localenv/cloud-nine-wallet/docker-compose.yml +++ b/localenv/cloud-nine-wallet/docker-compose.yml @@ -73,7 +73,7 @@ services: REDIS_URL: redis://shared-redis:6379/0 WALLET_ADDRESS_URL: ${CLOUD_NINE_WALLET_ADDRESS_URL:-https://cloud-nine-wallet-backend/.well-known/pay} ILP_CONNECTOR_ADDRESS: http://127.0.0.1:3002 - ENABLE_TELEMETRY: false + ENABLE_TELEMETRY: true KEY_ID: rafiki depends_on: - shared-database diff --git a/localenv/happy-life-bank/docker-compose.yml b/localenv/happy-life-bank/docker-compose.yml index 3ee9c74374..09a89e50fc 100644 --- a/localenv/happy-life-bank/docker-compose.yml +++ b/localenv/happy-life-bank/docker-compose.yml @@ -67,7 +67,7 @@ services: EXCHANGE_RATES_URL: http://happy-life-bank/rates REDIS_URL: redis://shared-redis:6379/2 WALLET_ADDRESS_URL: ${HAPPY_LIFE_BANK_WALLET_ADDRESS_URL:-https://happy-life-bank-backend/.well-known/pay} - ENABLE_TELEMETRY: false + ENABLE_TELEMETRY: true KEY_ID: rafiki depends_on: - cloud-nine-backend From 9a42bb015dc388ebe7cc33bd9fc5fa74d36dfb0b Mon Sep 17 00:00:00 2001 From: golobitch Date: Sun, 16 Jun 2024 16:26:34 +0200 Subject: [PATCH 09/15] fix(localenv): docker dompose connector address url variable --- localenv/cloud-nine-wallet/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/localenv/cloud-nine-wallet/docker-compose.yml b/localenv/cloud-nine-wallet/docker-compose.yml index 4ced035e18..a022242694 100644 --- a/localenv/cloud-nine-wallet/docker-compose.yml +++ b/localenv/cloud-nine-wallet/docker-compose.yml @@ -72,9 +72,9 @@ services: EXCHANGE_RATES_URL: http://cloud-nine-wallet/rates REDIS_URL: redis://shared-redis:6379/0 WALLET_ADDRESS_URL: ${CLOUD_NINE_WALLET_ADDRESS_URL:-https://cloud-nine-wallet-backend/.well-known/pay} - ILP_CONNECTOR_ADDRESS: http://127.0.0.1:3002 + ILP_CONNECTOR_ADDRESS: ${CLOUD_NINE_CONNECTOR_URL} ENABLE_TELEMETRY: true - KEY_ID: rafiki + KEY_ID: 7097F83B-CB84-469E-96C6-2141C72E22C0 depends_on: - shared-database - shared-redis From 020b79d1dce56acd7de8ff9a22182c55b49da617 Mon Sep 17 00:00:00 2001 From: golobitch Date: Sun, 16 Jun 2024 21:26:11 +0200 Subject: [PATCH 10/15] feat(backend): revert default tigerbeetle value --- packages/backend/src/config/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index 5d9d514f87..1b1b9d7028 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -100,7 +100,7 @@ export const Config = { ilpConnectorAddress: envString('ILP_CONNECTOR_ADDRESS'), instanceName: envString('INSTANCE_NAME'), streamSecret: Buffer.from(process.env.STREAM_SECRET || '', 'base64'), - useTigerbeetle: envBool('USE_TIGERBEETLE', true), + useTigerbeetle: envBool('USE_TIGERBEETLE', false), tigerbeetleClusterId: envInt('TIGERBEETLE_CLUSTER_ID', 0), tigerbeetleReplicaAddresses: process.env.TIGERBEETLE_REPLICA_ADDRESSES ? process.env.TIGERBEETLE_REPLICA_ADDRESSES.split(',') From 46eb2480c5eed74089456781f907ad9e1b441970 Mon Sep 17 00:00:00 2001 From: golobitch Date: Mon, 24 Jun 2024 20:51:47 +0200 Subject: [PATCH 11/15] feat(backend): sps payment pointer rename --- packages/backend/src/app.ts | 2 +- packages/backend/src/config/app.ts | 6 +++--- .../src/payment-method/ilp/spsp/middleware.test.ts | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/app.ts b/packages/backend/src/app.ts index 918e93edda..149da7190a 100644 --- a/packages/backend/src/app.ts +++ b/packages/backend/src/app.ts @@ -661,7 +661,7 @@ export class App { router.get( WALLET_ADDRESS_PATH, getWalletAddressUrlFromPath, - createSpspMiddleware(this.config.enableInterledgerPaymentPointers), + createSpspMiddleware(this.config.enableSpspPaymentPointers), createValidatorMiddleware( walletAddressServerSpec, { diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index 1b1b9d7028..62b0e1a73b 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -100,7 +100,7 @@ export const Config = { ilpConnectorAddress: envString('ILP_CONNECTOR_ADDRESS'), instanceName: envString('INSTANCE_NAME'), streamSecret: Buffer.from(process.env.STREAM_SECRET || '', 'base64'), - useTigerbeetle: envBool('USE_TIGERBEETLE', false), + useTigerbeetle: envBool('USE_TIGERBEETLE', true), tigerbeetleClusterId: envInt('TIGERBEETLE_CLUSTER_ID', 0), tigerbeetleReplicaAddresses: process.env.TIGERBEETLE_REPLICA_ADDRESSES ? process.env.TIGERBEETLE_REPLICA_ADDRESSES.split(',') @@ -166,8 +166,8 @@ export const Config = { 'INCOMING_PAYMENT_EXPIRY_MAX_MS', 2592000000 ), // 30 days - enableInterledgerPaymentPointers: envBool( - 'ENABLE_INTERLEDGER_PAYMENT_POINTERS', + enableSpspPaymentPointers: envBool( + 'ENABLE_SPSP_PAYMENT_POINTERS', true ) } diff --git a/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts b/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts index 0c89f248f7..a3f632f668 100644 --- a/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts +++ b/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts @@ -56,7 +56,7 @@ describe('SPSP Middleware', (): void => { }) test.each` - header | enableInterledgerPaymentPointers | description + header | enableSpspPaymentPointers | description ${'application/json'} | ${true} | ${'calls next'} ${'application/json'} | ${false} | ${'calls next'} ${'application/spsp4+json'} | ${true} | ${'calls SPSP route'} @@ -64,19 +64,19 @@ describe('SPSP Middleware', (): void => { ${'*/*'} | ${true} | ${'calls next'} ${'*/*'} | ${false} | ${'calls next'} `( - '$description for accept header: $header and enableInterledgerPaymentPointers: $enableInterledgerPaymentPointers', - async ({ header, enableInterledgerPaymentPointers }): Promise => { + '$description for accept header: $header and enableSpspPaymentPointers: $enableSpspPaymentPointers', + async ({ header, enableSpspPaymentPointers }): Promise => { const spspSpy = jest .spyOn(spspRoutes, 'get') .mockResolvedValueOnce(undefined) ctx.headers['accept'] = header const spspMiddleware = createSpspMiddleware( - enableInterledgerPaymentPointers + enableSpspPaymentPointers ) await expect(spspMiddleware(ctx, next)).resolves.toBeUndefined() if ( - enableInterledgerPaymentPointers && + enableSpspPaymentPointers && header == 'application/spsp4+json' ) { expect(spspSpy).toHaveBeenCalledTimes(1) From 87b72d1680cee5fc225fb45f9c92943d3e381302 Mon Sep 17 00:00:00 2001 From: golobitch Date: Mon, 24 Jun 2024 20:52:11 +0200 Subject: [PATCH 12/15] feat(docs): rename sps payment pointer --- .../documentation/src/content/docs/integration/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/documentation/src/content/docs/integration/deployment.md b/packages/documentation/src/content/docs/integration/deployment.md index b170d1b024..4033a89181 100644 --- a/packages/documentation/src/content/docs/integration/deployment.md +++ b/packages/documentation/src/content/docs/integration/deployment.md @@ -61,7 +61,7 @@ Now, the Admin UI can be found on localhost:3010. | `CONNECTOR_PORT` | backend.port.connector | `3002` | port of the ILP connector for for sending packets over ILP over HTTP | | `DATABASE_URL` | backend.postgresql.host, backend.postgresql.port, backend.postgresql.username, backend.postgresql.database, backend.postgresql.password | `postgresql://postgres:password@localhost:5432/development` | Postgres database URL of database storing the resource data; For Helm, these components are provided individually. | | `ENABLE_AUTO_PEERING` | | `false` | Flag to enable auto peering. View [documentation](/concepts/interledger-protocol/peering#auto-peering). | -| `ENABLE_INTERLEDGER_PAYMENT_POINTERS` | | `true` | enables [SPSP](/reference/glossary#simple-payments-setup-protocol-spsp) route | +| `ENABLE_SPS_PAYMENT_POINTERS` | | `true` | enables [SPSP](/reference/glossary#simple-payments-setup-protocol-spsp) route | | `EXCHANGE_RATES_LIFETIME` | backend.lifetime.exchangeRate | `15_000` | time in milliseconds the exchange rates provided by the ASE via the EXCHANGE_RATES_URL are valid for | | `EXCHANGE_RATES_URL` | backend.serviceUrls.EXCHANGE_RATES_URL | `undefined` | endpoint on the Account Servicing Entity to request exchange rates | | `GRAPHQL_IDEMPOTENCY_KEY_TTL_MS` | backend.idempotencyTTL | `86400000` | TTL in milliseconds for idempotencyKey on GraphQL mutations (Admin API). Default: 24hrs | From 52cd68caefbc29adc27a054196ad2cfa5faeab64 Mon Sep 17 00:00:00 2001 From: golobitch Date: Mon, 24 Jun 2024 20:52:46 +0200 Subject: [PATCH 13/15] feat(localenv): dummy uuid for keyid --- localenv/happy-life-bank/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localenv/happy-life-bank/docker-compose.yml b/localenv/happy-life-bank/docker-compose.yml index 09a89e50fc..e4fe7a3223 100644 --- a/localenv/happy-life-bank/docker-compose.yml +++ b/localenv/happy-life-bank/docker-compose.yml @@ -68,7 +68,7 @@ services: REDIS_URL: redis://shared-redis:6379/2 WALLET_ADDRESS_URL: ${HAPPY_LIFE_BANK_WALLET_ADDRESS_URL:-https://happy-life-bank-backend/.well-known/pay} ENABLE_TELEMETRY: true - KEY_ID: rafiki + KEY_ID: 53f2d913-e98a-40b9-b270-372d0547f23d depends_on: - cloud-nine-backend happy-life-auth: From cc4533d81b29645335cd1fce5be0775fffec3187 Mon Sep 17 00:00:00 2001 From: golobitch Date: Mon, 24 Jun 2024 21:02:55 +0200 Subject: [PATCH 14/15] chore(lint): everything --- packages/backend/src/config/app.ts | 5 +---- .../ilp/spsp/middleware.test.ts | 21 +++++++------------ .../content/docs/integration/deployment.md | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index 62b0e1a73b..de96b3ede7 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -166,10 +166,7 @@ export const Config = { 'INCOMING_PAYMENT_EXPIRY_MAX_MS', 2592000000 ), // 30 days - enableSpspPaymentPointers: envBool( - 'ENABLE_SPSP_PAYMENT_POINTERS', - true - ) + enableSpspPaymentPointers: envBool('ENABLE_SPSP_PAYMENT_POINTERS', true) } function parseRedisTlsConfig( diff --git a/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts b/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts index a3f632f668..9a4705f9c6 100644 --- a/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts +++ b/packages/backend/src/payment-method/ilp/spsp/middleware.test.ts @@ -57,12 +57,12 @@ describe('SPSP Middleware', (): void => { test.each` header | enableSpspPaymentPointers | description - ${'application/json'} | ${true} | ${'calls next'} - ${'application/json'} | ${false} | ${'calls next'} - ${'application/spsp4+json'} | ${true} | ${'calls SPSP route'} - ${'application/spsp4+json'} | ${false} | ${'calls next'} - ${'*/*'} | ${true} | ${'calls next'} - ${'*/*'} | ${false} | ${'calls next'} + ${'application/json'} | ${true} | ${'calls next'} + ${'application/json'} | ${false} | ${'calls next'} + ${'application/spsp4+json'} | ${true} | ${'calls SPSP route'} + ${'application/spsp4+json'} | ${false} | ${'calls next'} + ${'*/*'} | ${true} | ${'calls next'} + ${'*/*'} | ${false} | ${'calls next'} `( '$description for accept header: $header and enableSpspPaymentPointers: $enableSpspPaymentPointers', async ({ header, enableSpspPaymentPointers }): Promise => { @@ -70,15 +70,10 @@ describe('SPSP Middleware', (): void => { .spyOn(spspRoutes, 'get') .mockResolvedValueOnce(undefined) ctx.headers['accept'] = header - const spspMiddleware = createSpspMiddleware( - enableSpspPaymentPointers - ) + const spspMiddleware = createSpspMiddleware(enableSpspPaymentPointers) await expect(spspMiddleware(ctx, next)).resolves.toBeUndefined() - if ( - enableSpspPaymentPointers && - header == 'application/spsp4+json' - ) { + if (enableSpspPaymentPointers && header == 'application/spsp4+json') { expect(spspSpy).toHaveBeenCalledTimes(1) expect(next).not.toHaveBeenCalled() expect(ctx.paymentTag).toEqual(walletAddress.id) diff --git a/packages/documentation/src/content/docs/integration/deployment.md b/packages/documentation/src/content/docs/integration/deployment.md index 4033a89181..6c2bba0d08 100644 --- a/packages/documentation/src/content/docs/integration/deployment.md +++ b/packages/documentation/src/content/docs/integration/deployment.md @@ -61,7 +61,7 @@ Now, the Admin UI can be found on localhost:3010. | `CONNECTOR_PORT` | backend.port.connector | `3002` | port of the ILP connector for for sending packets over ILP over HTTP | | `DATABASE_URL` | backend.postgresql.host, backend.postgresql.port, backend.postgresql.username, backend.postgresql.database, backend.postgresql.password | `postgresql://postgres:password@localhost:5432/development` | Postgres database URL of database storing the resource data; For Helm, these components are provided individually. | | `ENABLE_AUTO_PEERING` | | `false` | Flag to enable auto peering. View [documentation](/concepts/interledger-protocol/peering#auto-peering). | -| `ENABLE_SPS_PAYMENT_POINTERS` | | `true` | enables [SPSP](/reference/glossary#simple-payments-setup-protocol-spsp) route | +| `ENABLE_SPS_PAYMENT_POINTERS` | | `true` | enables [SPSP](/reference/glossary#simple-payments-setup-protocol-spsp) route | | `EXCHANGE_RATES_LIFETIME` | backend.lifetime.exchangeRate | `15_000` | time in milliseconds the exchange rates provided by the ASE via the EXCHANGE_RATES_URL are valid for | | `EXCHANGE_RATES_URL` | backend.serviceUrls.EXCHANGE_RATES_URL | `undefined` | endpoint on the Account Servicing Entity to request exchange rates | | `GRAPHQL_IDEMPOTENCY_KEY_TTL_MS` | backend.idempotencyTTL | `86400000` | TTL in milliseconds for idempotencyKey on GraphQL mutations (Admin API). Default: 24hrs | From 9adfdd44a1bf5dcf88974086dd57e08bf27e2729 Mon Sep 17 00:00:00 2001 From: golobitch Date: Tue, 25 Jun 2024 10:21:57 +0200 Subject: [PATCH 15/15] chore(env): rename ilp connector address to ilp connector url --- localenv/cloud-nine-wallet/docker-compose.yml | 2 +- localenv/happy-life-bank/docker-compose.yml | 2 +- packages/backend/jest.config.js | 2 +- packages/backend/src/config/app.ts | 2 +- .../graphql/resolvers/auto-peering.test.ts | 10 ++-- .../ilp/auto-peering/routes.test.ts | 6 +-- .../payment-method/ilp/auto-peering/routes.ts | 2 +- .../ilp/auto-peering/service.test.ts | 52 +++++++++---------- .../ilp/auto-peering/service.ts | 20 +++---- .../concepts/interledger-protocol/peering.md | 4 +- .../content/docs/integration/deployment.md | 4 +- .../cloud-nine-wallet/docker-compose.yml | 2 +- .../happy-life-bank/docker-compose.yml | 2 +- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/localenv/cloud-nine-wallet/docker-compose.yml b/localenv/cloud-nine-wallet/docker-compose.yml index a022242694..9595c89bc6 100644 --- a/localenv/cloud-nine-wallet/docker-compose.yml +++ b/localenv/cloud-nine-wallet/docker-compose.yml @@ -72,7 +72,7 @@ services: EXCHANGE_RATES_URL: http://cloud-nine-wallet/rates REDIS_URL: redis://shared-redis:6379/0 WALLET_ADDRESS_URL: ${CLOUD_NINE_WALLET_ADDRESS_URL:-https://cloud-nine-wallet-backend/.well-known/pay} - ILP_CONNECTOR_ADDRESS: ${CLOUD_NINE_CONNECTOR_URL} + ILP_CONNECTOR_URL: ${CLOUD_NINE_CONNECTOR_URL} ENABLE_TELEMETRY: true KEY_ID: 7097F83B-CB84-469E-96C6-2141C72E22C0 depends_on: diff --git a/localenv/happy-life-bank/docker-compose.yml b/localenv/happy-life-bank/docker-compose.yml index e4fe7a3223..20f4e203b0 100644 --- a/localenv/happy-life-bank/docker-compose.yml +++ b/localenv/happy-life-bank/docker-compose.yml @@ -59,7 +59,7 @@ services: AUTH_SERVER_GRANT_URL: ${HAPPY_LIFE_BANK_AUTH_SERVER_DOMAIN:-http://happy-life-bank-auth:3006} AUTH_SERVER_INTROSPECTION_URL: http://happy-life-bank-auth:3007 ILP_ADDRESS: test.happy-life-bank - ILP_CONNECTOR_ADDRESS: http://127.0.0.1:4002 + ILP_CONNECTOR_URL: http://127.0.0.1:4002 STREAM_SECRET: BjPXtnd00G2mRQwP/8ZpwyZASOch5sUXT5o0iR5b5wU= API_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964= WEBHOOK_URL: http://happy-life-bank/webhooks diff --git a/packages/backend/jest.config.js b/packages/backend/jest.config.js index c1b70622ca..492a6e5e30 100644 --- a/packages/backend/jest.config.js +++ b/packages/backend/jest.config.js @@ -8,7 +8,7 @@ process.env.LOG_LEVEL = 'silent' process.env.INSTANCE_NAME = 'Rafiki' process.env.KEY_ID = 'myKey' process.env.OPEN_PAYMENTS_URL = 'http://127.0.0.1:3000' -process.env.ILP_CONNECTOR_ADDRESS = 'http://127.0.0.1:3002' +process.env.ILP_CONNECTOR_URL = 'http://127.0.0.1:3002' process.env.ILP_ADDRESS = 'test.rafiki' process.env.AUTH_SERVER_GRANT_URL = 'http://127.0.0.1:3006' process.env.AUTH_SERVER_INTROSPECTION_URL = 'http://127.0.0.1:3007/' diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index de96b3ede7..9e5659115c 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -97,7 +97,7 @@ export const Config = { process.env.REDIS_TLS_CERT_FILE_PATH ), ilpAddress: envString('ILP_ADDRESS'), - ilpConnectorAddress: envString('ILP_CONNECTOR_ADDRESS'), + ilpConnectorUrl: envString('ILP_CONNECTOR_URL'), instanceName: envString('INSTANCE_NAME'), streamSecret: Buffer.from(process.env.STREAM_SECRET || '', 'base64'), useTigerbeetle: envBool('USE_TIGERBEETLE', true), diff --git a/packages/backend/src/graphql/resolvers/auto-peering.test.ts b/packages/backend/src/graphql/resolvers/auto-peering.test.ts index 86f0f0a0ad..3a073130d3 100644 --- a/packages/backend/src/graphql/resolvers/auto-peering.test.ts +++ b/packages/backend/src/graphql/resolvers/auto-peering.test.ts @@ -112,7 +112,7 @@ describe('Auto Peering Resolvers', (): void => { const peerDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', name: 'Test Peer', httpToken: 'httpToken' } @@ -137,7 +137,7 @@ describe('Auto Peering Resolvers', (): void => { outgoing: { __typename: 'HttpOutgoing', authToken: expect.any(String), - endpoint: peerDetails.ilpConnectorAddress + endpoint: peerDetails.ilpConnectorUrl } }, maxPacketAmount: input.maxPacketAmount?.toString(), @@ -153,7 +153,7 @@ describe('Auto Peering Resolvers', (): void => { const peerDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', name: 'Test Peer', httpToken: 'httpToken' } @@ -187,7 +187,7 @@ describe('Auto Peering Resolvers', (): void => { outgoing: { __typename: 'HttpOutgoing', authToken: expect.any(String), - endpoint: peerDetails.ilpConnectorAddress + endpoint: peerDetails.ilpConnectorUrl } }, maxPacketAmount: input.maxPacketAmount?.toString(), @@ -221,7 +221,7 @@ describe('Auto Peering Resolvers', (): void => { outgoing: { __typename: 'HttpOutgoing', authToken: expect.any(String), - endpoint: peerDetails.ilpConnectorAddress + endpoint: peerDetails.ilpConnectorUrl } }, maxPacketAmount: secondInput.maxPacketAmount?.toString(), diff --git a/packages/backend/src/payment-method/ilp/auto-peering/routes.test.ts b/packages/backend/src/payment-method/ilp/auto-peering/routes.test.ts index f3bc49b3a9..d861ec8841 100644 --- a/packages/backend/src/payment-method/ilp/auto-peering/routes.test.ts +++ b/packages/backend/src/payment-method/ilp/auto-peering/routes.test.ts @@ -39,7 +39,7 @@ describe('Auto Peering Routes', (): void => { url: `/`, body: { staticIlpAddress: 'test.rafiki-money', - ilpConnectorAddress: 'http://peer.rafiki.money', + ilpConnectorUrl: 'http://peer.rafiki.money', asset: { code: asset.code, scale: asset.scale }, httpToken: 'someHttpToken', maxPacketAmount: 1000, @@ -53,7 +53,7 @@ describe('Auto Peering Routes', (): void => { expect(ctx.status).toBe(200) expect(ctx.body).toEqual({ staticIlpAddress: config.ilpAddress, - ilpConnectorAddress: config.ilpConnectorAddress, + ilpConnectorUrl: config.ilpConnectorUrl, httpToken: expect.any(String), name: config.instanceName }) @@ -65,7 +65,7 @@ describe('Auto Peering Routes', (): void => { url: `/`, body: { staticIlpAddress: 'test.rafiki-money', - ilpConnectorAddress: 'http://peer.rafiki.money', + ilpConnectorUrl: 'http://peer.rafiki.money', asset: { code: 'ABC', scale: 2 }, httpToken: 'someHttpToken' } diff --git a/packages/backend/src/payment-method/ilp/auto-peering/routes.ts b/packages/backend/src/payment-method/ilp/auto-peering/routes.ts index c6dd9a9fb6..1ec0197eaf 100644 --- a/packages/backend/src/payment-method/ilp/auto-peering/routes.ts +++ b/packages/backend/src/payment-method/ilp/auto-peering/routes.ts @@ -5,7 +5,7 @@ import { AutoPeeringService } from './service' interface PeeringRequestArgs { staticIlpAddress: string - ilpConnectorAddress: string + ilpConnectorUrl: string asset: { code: string; scale: number } httpToken: string maxPacketAmount?: number diff --git a/packages/backend/src/payment-method/ilp/auto-peering/service.test.ts b/packages/backend/src/payment-method/ilp/auto-peering/service.test.ts index 7789d20101..af2c2e2282 100644 --- a/packages/backend/src/payment-method/ilp/auto-peering/service.test.ts +++ b/packages/backend/src/payment-method/ilp/auto-peering/service.test.ts @@ -51,7 +51,7 @@ describe('Auto Peering Service', (): void => { const args: PeeringRequestArgs = { staticIlpAddress: 'test.rafiki-money', - ilpConnectorAddress: 'http://peer.rafiki.money', + ilpConnectorUrl: 'http://peer.rafiki.money', asset: { code: asset.code, scale: asset.scale }, httpToken: 'someHttpToken', name: 'Rafiki Money', @@ -64,7 +64,7 @@ describe('Auto Peering Service', (): void => { autoPeeringService.acceptPeeringRequest(args) ).resolves.toEqual({ staticIlpAddress: config.ilpAddress, - ilpConnectorAddress: config.ilpConnectorAddress, + ilpConnectorUrl: config.ilpConnectorUrl, httpToken: expect.any(String), name: config.instanceName }) @@ -78,7 +78,7 @@ describe('Auto Peering Service', (): void => { incoming: { authTokens: [args.httpToken] }, outgoing: { authToken: expect.any(String), - endpoint: args.ilpConnectorAddress + endpoint: args.ilpConnectorUrl } } }) @@ -89,7 +89,7 @@ describe('Auto Peering Service', (): void => { const args: PeeringRequestArgs = { staticIlpAddress: 'test.rafiki-money', - ilpConnectorAddress: 'http://peer.rafiki.money', + ilpConnectorUrl: 'http://peer.rafiki.money', asset: { code: asset.code, scale: asset.scale }, httpToken: 'someHttpToken', name: 'Rafiki Money' @@ -101,7 +101,7 @@ describe('Auto Peering Service', (): void => { autoPeeringService.acceptPeeringRequest(args) ).resolves.toEqual({ staticIlpAddress: config.ilpAddress, - ilpConnectorAddress: config.ilpConnectorAddress, + ilpConnectorUrl: config.ilpConnectorUrl, httpToken: expect.any(String), name: config.instanceName }) @@ -111,7 +111,7 @@ describe('Auto Peering Service', (): void => { autoPeeringService.acceptPeeringRequest(args) ).resolves.toEqual({ staticIlpAddress: config.ilpAddress, - ilpConnectorAddress: config.ilpConnectorAddress, + ilpConnectorUrl: config.ilpConnectorUrl, httpToken: expect.any(String), name: config.instanceName }) @@ -122,7 +122,7 @@ describe('Auto Peering Service', (): void => { incoming: { authTokens: [args.httpToken] }, outgoing: { authToken: expect.any(String), - endpoint: args.ilpConnectorAddress + endpoint: args.ilpConnectorUrl } } }) @@ -132,7 +132,7 @@ describe('Auto Peering Service', (): void => { test('returns error if unknown asset', async (): Promise => { const args: PeeringRequestArgs = { staticIlpAddress: 'test.rafiki-money', - ilpConnectorAddress: 'http://peer.rafiki.money', + ilpConnectorUrl: 'http://peer.rafiki.money', asset: { code: 'USD', scale: 2 }, httpToken: 'someHttpToken' } @@ -147,7 +147,7 @@ describe('Auto Peering Service', (): void => { const args: PeeringRequestArgs = { staticIlpAddress: 'test.rafiki-money', - ilpConnectorAddress: 'invalid', + ilpConnectorUrl: 'invalid', asset: { code: asset.code, scale: asset.scale }, httpToken: 'someHttpToken' } @@ -162,7 +162,7 @@ describe('Auto Peering Service', (): void => { const args: PeeringRequestArgs = { staticIlpAddress: 'invalid', - ilpConnectorAddress: 'http://peer.rafiki.money', + ilpConnectorUrl: 'http://peer.rafiki.money', asset: { code: asset.code, scale: asset.scale }, httpToken: 'someHttpToken' } @@ -177,7 +177,7 @@ describe('Auto Peering Service', (): void => { const args: PeeringRequestArgs = { staticIlpAddress: 'test.rafiki-money', - ilpConnectorAddress: 'http://peer.rafiki.money', + ilpConnectorUrl: 'http://peer.rafiki.money', asset: { code: asset.code, scale: asset.scale }, httpToken: 'someHttpToken' } @@ -219,7 +219,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: 'peerHttpToken', name: 'Peer 2' } @@ -232,7 +232,7 @@ describe('Auto Peering Service', (): void => { scale: asset.scale }, httpToken: expect.any(String), - ilpConnectorAddress: config.ilpConnectorAddress, + ilpConnectorUrl: config.ilpConnectorUrl, maxPacketAmount: Number(args.maxPacketAmount), name: config.instanceName, staticIlpAddress: config.ilpAddress @@ -255,7 +255,7 @@ describe('Auto Peering Service', (): void => { authTokens: [peerDetails.httpToken] }, outgoing: { - endpoint: peerDetails.ilpConnectorAddress, + endpoint: peerDetails.ilpConnectorUrl, authToken: expect.any(String) } }, @@ -280,7 +280,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: 'peerHttpToken', name: 'Peer 2' } @@ -293,7 +293,7 @@ describe('Auto Peering Service', (): void => { scale: asset.scale }, httpToken: expect.any(String), - ilpConnectorAddress: config.ilpConnectorAddress, + ilpConnectorUrl: config.ilpConnectorUrl, maxPacketAmount: Number(args.maxPacketAmount), name: config.instanceName, staticIlpAddress: config.ilpAddress @@ -326,7 +326,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: 'peerHttpToken', name: 'Peer 2' } @@ -339,7 +339,7 @@ describe('Auto Peering Service', (): void => { scale: asset.scale }, httpToken: expect.any(String), - ilpConnectorAddress: config.ilpConnectorAddress, + ilpConnectorUrl: config.ilpConnectorUrl, maxPacketAmount: Number(args.maxPacketAmount), name: config.instanceName, staticIlpAddress: config.ilpAddress @@ -366,7 +366,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: 'peerHttpToken', name: 'Peer 2' } @@ -387,7 +387,7 @@ describe('Auto Peering Service', (): void => { authTokens: [peerDetails.httpToken] }, outgoing: { - endpoint: peerDetails.ilpConnectorAddress, + endpoint: peerDetails.ilpConnectorUrl, authToken: expect.any(String) } }, @@ -477,7 +477,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: '', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: 'peerHttpToken', name: 'Peer 2' } @@ -500,7 +500,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: '', + ilpConnectorUrl: '', httpToken: 'peerHttpToken', name: 'Peer 2' } @@ -523,7 +523,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: uuid(), name: 'Peer 2' } @@ -579,7 +579,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: uuid(), name: 'Peer 2' } @@ -617,7 +617,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: uuid(), name: 'Peer 2' } @@ -649,7 +649,7 @@ describe('Auto Peering Service', (): void => { const peerDetails: PeeringDetails = { staticIlpAddress: 'test.peer2', - ilpConnectorAddress: 'http://peer-two.com', + ilpConnectorUrl: 'http://peer-two.com', httpToken: 'peerHttpToken', name: 'Peer 2' } diff --git a/packages/backend/src/payment-method/ilp/auto-peering/service.ts b/packages/backend/src/payment-method/ilp/auto-peering/service.ts index ea9f77ba6b..31d1e60ea9 100644 --- a/packages/backend/src/payment-method/ilp/auto-peering/service.ts +++ b/packages/backend/src/payment-method/ilp/auto-peering/service.ts @@ -11,7 +11,7 @@ import { isTransferError } from '../../../accounting/errors' export interface PeeringDetails { staticIlpAddress: string - ilpConnectorAddress: string + ilpConnectorUrl: string httpToken: string name: string } @@ -27,7 +27,7 @@ export interface InitiatePeeringRequestArgs { export interface PeeringRequestArgs { staticIlpAddress: string - ilpConnectorAddress: string + ilpConnectorUrl: string asset: { code: string; scale: number } httpToken: string maxPacketAmount?: number @@ -36,7 +36,7 @@ export interface PeeringRequestArgs { interface UpdatePeerArgs { staticIlpAddress: string - ilpConnectorAddress: string + ilpConnectorUrl: string assetId: string incomingHttpToken: string outgoingHttpToken: string @@ -96,7 +96,7 @@ async function initiatePeeringRequest( const outgoingHttpToken = uuid() const peeringDetailsOrError = await sendPeeringRequest(deps, peerUrl, { - ilpConnectorAddress: deps.config.ilpConnectorAddress, + ilpConnectorUrl: deps.config.ilpConnectorUrl, staticIlpAddress: deps.config.ilpAddress, asset: { code: asset.code, scale: asset.scale }, httpToken: outgoingHttpToken, @@ -120,7 +120,7 @@ async function initiatePeeringRequest( }, outgoing: { authToken: outgoingHttpToken, - endpoint: peeringDetailsOrError.ilpConnectorAddress + endpoint: peeringDetailsOrError.ilpConnectorUrl } } }) @@ -139,7 +139,7 @@ async function initiatePeeringRequest( assetId: asset.id, outgoingHttpToken, incomingHttpToken: peeringDetailsOrError.httpToken, - ilpConnectorAddress: peeringDetailsOrError.ilpConnectorAddress + ilpConnectorUrl: peeringDetailsOrError.ilpConnectorUrl }) : createdPeerOrError @@ -243,7 +243,7 @@ async function acceptPeeringRequest( authTokens: [args.httpToken] }, outgoing: { - endpoint: args.ilpConnectorAddress, + endpoint: args.ilpConnectorUrl, authToken: outgoingHttpToken } }, @@ -262,7 +262,7 @@ async function acceptPeeringRequest( assetId: asset.id, outgoingHttpToken, incomingHttpToken: args.httpToken, - ilpConnectorAddress: args.ilpConnectorAddress + ilpConnectorUrl: args.ilpConnectorUrl }) : createdPeerOrError @@ -275,7 +275,7 @@ async function acceptPeeringRequest( } return { - ilpConnectorAddress: deps.config.ilpConnectorAddress, + ilpConnectorUrl: deps.config.ilpConnectorUrl, staticIlpAddress: deps.config.ilpAddress, httpToken: peerOrError.http.outgoing.authToken, name: deps.config.instanceName @@ -306,7 +306,7 @@ async function updatePeer( incoming: { authTokens: [args.incomingHttpToken] }, outgoing: { authToken: args.outgoingHttpToken, - endpoint: args.ilpConnectorAddress + endpoint: args.ilpConnectorUrl } } }) diff --git a/packages/documentation/src/content/docs/concepts/interledger-protocol/peering.md b/packages/documentation/src/content/docs/concepts/interledger-protocol/peering.md index 43fe14afd1..de7994149b 100644 --- a/packages/documentation/src/content/docs/concepts/interledger-protocol/peering.md +++ b/packages/documentation/src/content/docs/concepts/interledger-protocol/peering.md @@ -362,14 +362,14 @@ with the input being: } ``` -Calling this mutation will exchange ILP peering information (`staticIlpAddress` `ilpConnectorAddress`, auth tokens) automatically. The instance being peered with will issue a default amount of liquidity, and you can begin sending payments to wallet addresses at the other Rafiki instance. +Calling this mutation will exchange ILP peering information (`staticIlpAddress` `ilpConnectorUrl`, auth tokens) automatically. The instance being peered with will issue a default amount of liquidity, and you can begin sending payments to wallet addresses at the other Rafiki instance. ### Prerequisites Before making the `createOrUpdatePeerByUrl` request, a few `backend` environment variables about your Rafiki instance need to be configured: 1. `ILP_ADDRESS`: The static ILP address of your Rafiki instance. This should already be defined in order to support ILP payments. -2. `ILP_CONNECTOR_ADDRESS`: The full address of the ILP connector that will receive ILP packets. Locally and by default, it is on `0.0.0.0:3002`. +2. `ILP_CONNECTOR_URL`: The full address of the ILP connector that will receive ILP packets. Locally and by default, it is on `0.0.0.0:3002`. 3. `INSTANCE_NAME`: The name of your Rafiki instance. This is how your peer will identify you. ### How to enable auto-peering diff --git a/packages/documentation/src/content/docs/integration/deployment.md b/packages/documentation/src/content/docs/integration/deployment.md index 6c2bba0d08..d1615e985c 100644 --- a/packages/documentation/src/content/docs/integration/deployment.md +++ b/packages/documentation/src/content/docs/integration/deployment.md @@ -61,13 +61,13 @@ Now, the Admin UI can be found on localhost:3010. | `CONNECTOR_PORT` | backend.port.connector | `3002` | port of the ILP connector for for sending packets over ILP over HTTP | | `DATABASE_URL` | backend.postgresql.host, backend.postgresql.port, backend.postgresql.username, backend.postgresql.database, backend.postgresql.password | `postgresql://postgres:password@localhost:5432/development` | Postgres database URL of database storing the resource data; For Helm, these components are provided individually. | | `ENABLE_AUTO_PEERING` | | `false` | Flag to enable auto peering. View [documentation](/concepts/interledger-protocol/peering#auto-peering). | -| `ENABLE_SPS_PAYMENT_POINTERS` | | `true` | enables [SPSP](/reference/glossary#simple-payments-setup-protocol-spsp) route | +| `ENABLE_SPSP_PAYMENT_POINTERS` | | `true` | enables [SPSP](/reference/glossary#simple-payments-setup-protocol-spsp) route | | `EXCHANGE_RATES_LIFETIME` | backend.lifetime.exchangeRate | `15_000` | time in milliseconds the exchange rates provided by the ASE via the EXCHANGE_RATES_URL are valid for | | `EXCHANGE_RATES_URL` | backend.serviceUrls.EXCHANGE_RATES_URL | `undefined` | endpoint on the Account Servicing Entity to request exchange rates | | `GRAPHQL_IDEMPOTENCY_KEY_TTL_MS` | backend.idempotencyTTL | `86400000` | TTL in milliseconds for idempotencyKey on GraphQL mutations (Admin API). Default: 24hrs | | `GRAPHQL_IDEMPOTENCY_KEY_LOCK_MS` | | `2000` | TTL in milliseconds for idempotencyKey concurrency lock on GraphQL mutations (Admin API) | | `ILP_ADDRESS` | backend.ilp.address | `undefined` | ILP address of this Rafiki instance | -| `ILP_CONNECTOR_ADDRESS` | | `undefined` | The ILP connector address where ILP packets are received. Communicated during [auto-peering](/concepts/interledger-protocol/peering#auto-peering) | +| `ILP_CONNECTOR_URL` | | `undefined` | The ILP connector address where ILP packets are received. Communicated during [auto-peering](/concepts/interledger-protocol/peering#auto-peering) | | `INCOMING_PAYMENT_EXPIRY_MAX_MS` | | `2592000000` | Maximum milliseconds into the future incoming payments expiry can be set to on creation. Default: 30 days | | `INCOMING_PAYMENT_WORKERS` | backend.workers.incomingPayment | `1` | number of workers processing incoming payment requests | | `INCOMING_PAYMENT_WORKER_IDLE` | backend.workerIdle | `200` | time in milliseconds that INCOMING_PAYMENT_WORKERS will wait until they check an empty incoming payment request queue again | diff --git a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml index 934cd14099..090b75257e 100644 --- a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml +++ b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml @@ -32,7 +32,7 @@ services: AUTH_SERVER_INTROSPECTION_URL: http://cloud-nine-wallet-test-auth:3107 AUTH_SERVER_GRANT_URL: http://cloud-nine-wallet-test-auth:3106 ILP_ADDRESS: test.cloud-nine-wallet-test - ILP_CONNECTOR_ADDRESS: http://127.0.0.1:3102 + ILP_CONNECTOR_URL: http://127.0.0.1:3102 STREAM_SECRET: BjPXtnd00G2mRQwP/8ZpwyZASOch5sUXT5o0iR5b5wU= WEBHOOK_URL: http://host.docker.internal:8888/webhooks EXCHANGE_RATES_URL: http://host.docker.internal:8888/rates diff --git a/test/integration/testenv/happy-life-bank/docker-compose.yml b/test/integration/testenv/happy-life-bank/docker-compose.yml index aa76735b34..91c84487c1 100644 --- a/test/integration/testenv/happy-life-bank/docker-compose.yml +++ b/test/integration/testenv/happy-life-bank/docker-compose.yml @@ -30,7 +30,7 @@ services: KEY_ID: keyid-97a3a431-8ee1-48fc-ac85-70e2f5eba8e5 PRIVATE_KEY_FILE: /workspace/private-key.pem ILP_ADDRESS: test.happy-life-bank-test - ILP_CONNECTOR_ADDRESS: http://127.0.0.1:4102 + ILP_CONNECTOR_URL: http://127.0.0.1:4102 STREAM_SECRET: BjPXtnd00G2mRQwP/8ZpwyZASOch5sUXT5o0iR5b5wU= WEBHOOK_URL: http://host.docker.internal:8889/webhooks EXCHANGE_RATES_URL: http://host.docker.internal:8889/rates