Skip to content

Commit f6df7bc

Browse files
committed
fix: use correct api auth url
1 parent f6aa938 commit f6df7bc

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

docs/env-vars.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ _Object containing the following properties:_
1010
| `TARGET_SOLUTION_NAMESPACES` | If set it will only install solutions that namespaces are specified in this env. variable. Comma-separated. | `string` | |
1111
| `RETRY_WORKER_CHECKS` | If it's enabled it will indefinitely await for worker to pass all checks otherwise it will kill process. Useful e.g if worker account is not yet assigned to operator at the moment of configuration. | `boolean` (_nullable_) | `true` |
1212
| `ENABLE_HEALTH_API` | If it's enabled it will enable health check routes. | `boolean` (_nullable_) | `true` |
13-
| `PALLET_RPC_URL` | Read EWX Parachain URL | `string` (_url_) | |
13+
| `PALLET_RPC_URL` | Read EWX Parachain URL. If provided, it will overwrite value provided from BASE_URLS. | `string` (_url_) | |
1414
| **`VOTING_RPC_URL`** (\*) | Write EWX Parachain URL | `string` (_url_) | |
1515
| **`VOTING_WORKER_SEED`** (\*) | Seed of the worker (not operator) | `string` | |
1616
| `PORT` | Port number of NodeRed Server. | `number` (_>0_) | `8000` |
@@ -30,9 +30,9 @@ _Object containing the following properties:_
3030
| `HEARTBEAT_PATH` | Path to the heartbeat file used for monitoring. | `string` | `'heartbeat_monitor.txt'` |
3131
| `HEARTBEAT_INTERVAL` | Interval (in ms) at which the heartbeat process updates the file. | `number` (_>0_) | `5000` |
3232
| `HEARTBEAT_PRINT_SUCCESS_LOG` | Should print successful logs. | `'true' \| 'false'` | `'true'` |
33-
| `PALLET_AUTH_SERVER_LOGIN_URL` | Pallet Auth Server Url used for authentication to Workers Registry | `string` (_url_) | |
33+
| `PALLET_AUTH_SERVER_LOGIN_URL` | Pallet Auth Server Url used for authentication to Workers Registry. If provided, it will overwrite value provided from BASE_URLS. | `string` (_url_) | |
3434
| `PALLET_AUTH_SERVER_DOMAIN` | Pallet Auth Server domain | `string` | `'default'` |
35-
| `WORKER_REGISTRY_URL` | Url of Workers Registry that stores information about Worker Location | `string` (_url_) | |
35+
| `WORKER_REGISTRY_URL` | Url of Workers Registry that stores information about Worker Location. If provided, it will overwrite value provided from BASE_URLS. | `string` (_url_) | |
3636
| `BASE_URLS` | Base URLs of EWX resources | `string` (_url_) | `'https://marketplace-cdn.energyweb.org/base_urls.json'` |
3737
| `BUILD_METADATA_PATH` | Path to build metadata file | `string` | `'./build.json'` |
3838

src/auth/login.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ const obtainTokenFromAuthServer = async (
154154
): Promise<string | null> => {
155155
const baseUrls: BaseUrlsConfig = await getBaseUrls();
156156

157-
const authUrl: string = `${baseUrls.authServerUrl}/api/auth/login`;
157+
const authUrl: string = baseUrls.authServerUrl.includes('api/auth/login')
158+
? baseUrls.authServerUrl
159+
: `${baseUrls.authServerUrl}/api/auth/login`;
158160

159161
logger.info(
160162
{

src/config.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ export const ENV_SCHEMA = z.object({
6363
.boolean()
6464
.default(true)
6565
.describe(`If it's enabled it will enable health check routes.`),
66-
PALLET_RPC_URL: z.string().url().describe('Read EWX Parachain URL').optional(),
66+
PALLET_RPC_URL: z
67+
.string()
68+
.url()
69+
.describe(
70+
'Read EWX Parachain URL. If provided, it will overwrite value provided from BASE_URLS.',
71+
)
72+
.optional(),
6773
VOTING_RPC_URL: z.string().url().describe('Write EWX Parachain URL'),
6874
VOTING_WORKER_SEED: z.string().describe('Seed of the worker (not operator)'),
6975
PORT: z.coerce.number().positive().default(8000).describe('Port number of NodeRed Server.'),
@@ -118,13 +124,17 @@ export const ENV_SCHEMA = z.object({
118124
PALLET_AUTH_SERVER_LOGIN_URL: z
119125
.string()
120126
.url()
121-
.describe('Pallet Auth Server Url used for authentication to Workers Registry')
127+
.describe(
128+
'Pallet Auth Server Url used for authentication to Workers Registry. If provided, it will overwrite value provided from BASE_URLS.',
129+
)
122130
.optional(),
123131
PALLET_AUTH_SERVER_DOMAIN: z.string().default('default').describe('Pallet Auth Server domain'),
124132
WORKER_REGISTRY_URL: z
125133
.string()
126134
.url()
127-
.describe('Url of Workers Registry that stores information about Worker Location')
135+
.describe(
136+
'Url of Workers Registry that stores information about Worker Location. If provided, it will overwrite value provided from BASE_URLS.',
137+
)
128138
.optional(),
129139
BASE_URLS: z
130140
.string()

0 commit comments

Comments
 (0)