mocks-server/main

MOCKS_SERVER_PLUGINS_ADMIN_API_PORT env has no effect

Closed this issue · 1 comments

Describe the bug
I have tried to set up Mocks Server in a docker compose. Setting the MOCKS_SERVER_PORT does work.
However setting MOCKS_SERVER_PLUGINS_ADMIN_API_PORT has no effect. It still uses port 3110.
Looking at the documentation I had a suspicion that the environment variable should have been MOCKS_SERVER_PLUGINS_ADMINAPI_PORT. No luck.

To Reproduce
Start the Mocks Server using the attached docker compose and note that the reported port is still 3110.
Note that the admin server on 3110 works.

Expected behavior
The Admin console should be pressent at http://localhost:4110.

Logs

start
mocks-server

05:10:21:51 [warn][alerts:scaffold] Configuration file was not found. A scaffold was created
05:10:21:51 [info][scaffold] Creating config file
05:10:21:60 [info][config] Configuration loaded
05:10:21:62 [info][files] Loading files from folder /input/mocks
05:10:21:89 [info][mock] Selected collection: 'base'
05:10:21:90 [info][server] Server started and listening at http://localhost:4100
05:10:21:92 [info][plugins:adminApi:server] Server started and listening at http://localhost:3110

** Operating system, Node.js an npm versions, or browser version (please complete the following information):**

  • OS: Docker Desktop (image: mocksserver/main)
  • Node.js: NA
  • npm: NA
  • Browser: Microsoft Edge Version 112.0.1722.48 (Official build) (64-bit)

Additional context
Docker-compose file:

version: '3.4'

services:
DipMocksServer:
image: mocksserver/main
ports:
- 3100:3100
- 3110:3110
environment:
- MOCKS_SERVER_PORT=3100
- MOCKS_SERVER_PLUGINS_ADMIN_API_PORT=3110
volumes:
- type: bind
source: ./UserSettings/dipMockConfig
target: /input

PrivilegesMocksServer:
image: mocksserver/main
ports:
- 4100:4100
- 4110:4110
environment:
- MOCKS_SERVER_PORT=4100
- MOCKS_SERVER_PLUGINS_ADMIN_API_PORT=4110 # Option has no effect - bug?
volumes:
- type: bind
source: ./UserSettings/privilegesMockConfig
target: /input

Hi @karstentellingnielsen,

The environment variable you should use is MOCKS_PLUGINS_ADMIN_API_PORT, not MOCKS_SERVER_PLUGINS_ADMIN_API_PORT. That's because the prefix of the environment variables is only MOCKS, not MOCKS_SERVER (in the case of the main port, it starts with MOCKS_SERVER because the port is under the SERVER namespace. You can look at the mocks.config.js file to get an idea of config namespaces.