From 525fabebf7a8715843debb49b54bfa9f13e1a2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Tesa=C5=99?= Date: Sun, 29 Oct 2023 10:42:53 +0100 Subject: [PATCH] Add stage to signed API --- packages/e2e/src/pusher/pusher.json | 3 ++- packages/pusher/README.md | 6 ++++++ packages/pusher/config/pusher.example.json | 3 ++- packages/pusher/src/validation/schema.ts | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/e2e/src/pusher/pusher.json b/packages/e2e/src/pusher/pusher.json index fefb938d..35a39473 100644 --- a/packages/e2e/src/pusher/pusher.json +++ b/packages/e2e/src/pusher/pusher.json @@ -109,6 +109,7 @@ "nodeSettings": { "nodeVersion": "0.1.0", "airnodeWalletMnemonic": "diamond result history offer forest diagram crop armed stumble orchard stage glance", - "rateLimiting": { "Mock API": { "maxConcurrency": 25, "minTime": 0 } } + "rateLimiting": { "Mock API": { "maxConcurrency": 25, "minTime": 0 } }, + "stage": "local-example" } } diff --git a/packages/pusher/README.md b/packages/pusher/README.md index 4e5df255..74c12e38 100644 --- a/packages/pusher/README.md +++ b/packages/pusher/README.md @@ -317,6 +317,12 @@ secrets. For example: "airnodeWalletMnemonic": "${WALLET_MNEMONIC}" ``` +##### `stage` + +An identifier of the deployment stage. This is used to distinguish between different deployments of pusher, for example +`dev`, `staging` or `production`. The stage value can have 16 characters at maximum and can only include lowercase +alphanumeric characters and hyphens. + ##### `rateLimiting` Configuration for rate limiting OIS requests. Rate limiting can be configured for each OIS separately. For example: diff --git a/packages/pusher/config/pusher.example.json b/packages/pusher/config/pusher.example.json index 8ea70bf9..d0be548e 100644 --- a/packages/pusher/config/pusher.example.json +++ b/packages/pusher/config/pusher.example.json @@ -95,6 +95,7 @@ "nodeSettings": { "nodeVersion": "0.1.0", "airnodeWalletMnemonic": "${WALLET_MNEMONIC}", - "rateLimiting": { "Nodary": { "maxConcurrency": 25, "minTime": 10 } } + "rateLimiting": { "Nodary": { "maxConcurrency": 25, "minTime": 10 } }, + "stage": "local-example" } } diff --git a/packages/pusher/src/validation/schema.ts b/packages/pusher/src/validation/schema.ts index 8d2109db..946a7aa3 100644 --- a/packages/pusher/src/validation/schema.ts +++ b/packages/pusher/src/validation/schema.ts @@ -251,6 +251,9 @@ export const nodeSettingsSchema = z.object({ nodeVersion: z.string().refine((version) => version === packageJson.version, 'Invalid node version'), airnodeWalletMnemonic: z.string().refine((mnemonic) => ethers.utils.isValidMnemonic(mnemonic), 'Invalid mnemonic'), rateLimiting: rateLimitingSchema, + stage: z + .string() + .regex(/^[\da-z-]{1,16}$/, 'Only lowercase letters, numbers and hyphens are allowed (max 16 characters)'), }); export type NodeSettings = z.infer;