diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a8766ae..f0fb27d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,8 @@ Put the following credentials in the environment: ```bash # Self-Managed export ZEEBE_SECURE_CONNECTION=false -export ZEEBE_ADDRESS='localhost:26500' +export ZEEBE_GRPC_ADDRESS='localhost:26500' +export ZEEBE_REST_ADDRESS='localhost:8080/v1/' export ZEEBE_CLIENT_ID='zeebe' export ZEEBE_CLIENT_SECRET='zecret' export ZEEBE_AUTHORIZATION_SERVER_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token' @@ -74,7 +75,8 @@ To run the multi-tenancy tests, use the following environment variables: ```bash # Self-Managed export ZEEBE_SECURE_CONNECTION=false -export ZEEBE_ADDRESS='localhost:26500' +export ZEEBE_GRPC_ADDRESS='localhost:26500' +export ZEEBE_REST_ADDRESS='localhost:8080/v1/' export ZEEBE_CLIENT_ID='zeebe' export ZEEBE_CLIENT_SECRET='zecret' export ZEEBE_AUTHORIZATION_SERVER_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token' diff --git a/QUICKSTART.md b/QUICKSTART.md index 190edd7d..fd36241c 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -39,7 +39,8 @@ The environment variables that you need to set are the following (replace with y ```bash # Self-Managed -export ZEEBE_ADDRESS='localhost:26500' +export ZEEBE_GRPC_ADDRESS='localhost:26500' +export ZEEBE_REST_ADDRESS='localhost:8080/v1/' export ZEEBE_CLIENT_ID='zeebe' export ZEEBE_CLIENT_SECRET='zecret' export CAMUNDA_OAUTH_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token' @@ -64,7 +65,8 @@ export CAMUNDA_SECURE_CONNECTION=false ### Camunda SaaS configuration ```bash -export ZEEBE_ADDRESS='5c34c0a7-...-125615f7a9b9.syd-1.zeebe.camunda.io:443' +export ZEEBE_GRPC_ADDRESS='5c34c0a7-...-125615f7a9b9.syd-1.zeebe.camunda.io:443' +export ZEEBE_REST_ADDRESS='https://syd-1.zeebe.camunda.io/5c34c0a7-7f29-4424-8414-125615f7a9b9' export ZEEBE_CLIENT_ID='yvvURO...' export ZEEBE_CLIENT_SECRET='iJJu-SHg...' export CAMUNDA_TASKLIST_BASE_URL='https://syd-1.tasklist.camunda.io/5c34c0a7-...-125615f7a9b9' diff --git a/README.md b/README.md index 8905826f..da6413ee 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ With this environment variable set, the SDK will inject a `NullAuthProvider` tha To get a token for use with the application APIs, provide the following configuration fields at a minimum, either via the `Camunda8` constructor or in environment variables: ```bash -ZEEBE_ADDRESS +ZEEBE_GRPC_ADDRESS ZEEBE_CLIENT_ID ZEEBE_CLIENT_SECRET CAMUNDA_OAUTH_URL @@ -118,7 +118,8 @@ This is the complete environment configuration needed to run against the Dockeri ```bash # Self-Managed -export ZEEBE_ADDRESS='localhost:26500' +export ZEEBE_GRPC_ADDRESS='localhost:26500' +export ZEEBE_REST_ADDRESS='localhost:8080/v1/' export ZEEBE_CLIENT_ID='zeebe' export ZEEBE_CLIENT_SECRET='zecret' export CAMUNDA_OAUTH_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token' @@ -147,15 +148,16 @@ Here is an example of doing this via the constructor, rather than via the enviro import { Camunda8 } from '@camunda8/sdk' const c8 = new Camunda8({ - ZEEBE_ADDRESS: 'localhost:26500' - ZEEBE_CLIENT_ID: 'zeebe' - ZEEBE_CLIENT_SECRET: 'zecret' - CAMUNDA_OAUTH_URL: 'http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token' - CAMUNDA_TASKLIST_BASE_URL: 'http://localhost:8082' - CAMUNDA_OPERATE_BASE_URL: 'http://localhost:8081' - CAMUNDA_OPTIMIZE_BASE_URL: 'http://localhost:8083' - CAMUNDA_MODELER_BASE_URL: 'http://localhost:8070/api' - CAMUNDA_TENANT_ID: '' // We can override values in the env by passing an empty string value + ZEEBE_GRPC_ADDRESS: 'localhost:26500', + ZEEBE_REST_ADDRESS: 'localhost:8080/v1/', + ZEEBE_CLIENT_ID: 'zeebe', + ZEEBE_CLIENT_SECRET: 'zecret', + CAMUNDA_OAUTH_URL: 'http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token', + CAMUNDA_TASKLIST_BASE_URL: 'http://localhost:8082', + CAMUNDA_OPERATE_BASE_URL: 'http://localhost:8081', + CAMUNDA_OPTIMIZE_BASE_URL: 'http://localhost:8083', + CAMUNDA_MODELER_BASE_URL: 'http://localhost:8070/api', + CAMUNDA_TENANT_ID: '', // We can override values in the env by passing an empty string value CAMUNDA_SECURE_CONNECTION: false }) ``` @@ -165,7 +167,8 @@ const c8 = new Camunda8({ Here is a complete configuration example for connection to Camunda SaaS: ```bash -export ZEEBE_ADDRESS='5c34c0a7-7f29-4424-8414-125615f7a9b9.syd-1.zeebe.camunda.io:443' +export ZEEBE_GRPC_ADDRESS='5c34c0a7-7f29-4424-8414-125615f7a9b9.syd-1.zeebe.camunda.io:443' +export ZEEBE_REST_ADDRESS='https://yd-1.zeebe.camunda.io/5c34c0a7-7f29-4424-8414-125615f7a9b9' export ZEEBE_CLIENT_ID='yvvURO9TmBnP3zx4Xd8Ho6apgeiZTjn6' export ZEEBE_CLIENT_SECRET='iJJu-SHgUtuJTTAMnMLdcb8WGF8s2mHfXhXutEwe8eSbLXn98vUpoxtuLk5uG0en' # export CAMUNDA_CREDENTIALS_SCOPES='Zeebe,Tasklist,Operate,Optimize' # What APIs these client creds are authorised for diff --git a/smoke-test/smoke-test.js b/smoke-test/smoke-test.js index 5f574706..e6d65084 100644 --- a/smoke-test/smoke-test.js +++ b/smoke-test/smoke-test.js @@ -6,7 +6,8 @@ console.log('Running smoke test...') const camunda = new Camunda8({ CAMUNDA_OAUTH_DISABLED: true, - ZEEBE_ADDRESS: 'localhost:26500', + ZEEBE_ADDRESS: 'localhost:26500', // to be deprecated + ZEEBE_GRPC_ADDRESS: 'localhost:26500', ZEEBE_CLIENT_ID: 'zeebeClientId', ZEEBE_CLIENT_SECRET: 'zeebeClientSecret', CAMUNDA_CONSOLE_BASE_URL: 'http://localhost:8080', diff --git a/src/lib/Configuration.ts b/src/lib/Configuration.ts index 0b8bcce6..14d42c19 100644 --- a/src/lib/Configuration.ts +++ b/src/lib/Configuration.ts @@ -20,6 +20,17 @@ const getMainEnv = () => optional: true, default: 1000, }, + /** The address for the Zeebe GRPC. */ + ZEEBE_GRPC_ADDRESS: { + type: 'string', + optional: true, + }, + /** The address for the Zeebe REST API. Defaults to localhost:8080 */ + ZEEBE_REST_ADDRESS: { + type: 'string', + optional: true, + default: 'http://localhost:8080', + }, /** The address for the Zeebe Gateway. Defaults to localhost:26500 */ ZEEBE_ADDRESS: { type: 'string', @@ -364,6 +375,8 @@ export const CamundaEnvironmentVariableDictionary = 'CAMUNDA_TOKEN_SCOPE', 'CAMUNDA_ZEEBE_OAUTH_AUDIENCE', 'GRPC_KEEPALIVE_TIME_MS', + 'ZEEBE_REST_ADDRESS', + 'ZEEBE_GRPC_ADDRESS', 'ZEEBE_ADDRESS', 'ZEEBE_CLIENT_ID', 'ZEEBE_CLIENT_SECRET', diff --git a/src/zeebe/zb/ZeebeGrpcClient.ts b/src/zeebe/zb/ZeebeGrpcClient.ts index 72ae63ff..68ffab87 100644 --- a/src/zeebe/zb/ZeebeGrpcClient.ts +++ b/src/zeebe/zb/ZeebeGrpcClient.ts @@ -131,8 +131,8 @@ export class ZeebeGrpcClient extends TypedEmitter< this.tenantId = this.options.tenantId this.gatewayAddress = RequireConfiguration( - config.ZEEBE_ADDRESS, - 'ZEEBE_ADDRESS' + config.ZEEBE_ADDRESS || config.ZEEBE_GRPC_ADDRESS, + 'ZEEBE_GRPC_ADDRESS' ) debug('Gateway address: ', this.gatewayAddress)