buerokratt / Maintenance

Repo with temporary content
MIT License
0 stars 0 forks source link

Allow Ruuter to make requests to other localhost services binded with ports #6

Closed turnerrainer closed 1 year ago

turnerrainer commented 1 year ago

AS A Developer I WANT TO make requests via Ruuter to different localhost services running on different ports SO THAT I could use my usual development environment

Acceptance Criteria

turnerrainer commented 1 year ago

Step 1 - update Ruuter's docker-compose.yml

Add extra_hosts under services.ruuter

docker-compose.yml should look like this:

version: '3.9'
services:
  ruuter:
    container_name: ruuter
    build:
      context: .
    volumes:
      - ./DSL:/DSL
    ports:
      - 8080:8080
    networks:
      - ruuter
    extra_hosts:
      - "host.docker.internal:host-gateway"

networks:
  ruuter:
    driver: bridge

Step 2 - change localhost URL's in Ruuter DSLs

When using localhost:<port> URLs in Ruuter DSLs to use other than Ruuter itself, replace http://localhost:<port> with http://host.docker.internal:<port>

A working example /DSL/GET/mocks/localhost.yml looks like

step_1:
  call: http.get
  args:
    url: http://host.docker.internal:8085
  result: nginx

step_2:
  return: ${nginx.response}
turnerrainer commented 1 year ago

Closed based on the comment added, no development was needed.