Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Вынес ссылки на сервисы в docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan committed Feb 14, 2024
1 parent 086c9ef commit f8e89f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docker-compose-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ services:
command: uvicorn app.gateway_service:app --reload --host 0.0.0.0 --port 8001
ports:
- "8001:8001"
environment:
- USER_SERVICE_URL=http://user_service:8002
- ROUTE_URL=http://route_waypoint_service:8003
- POINT_URL=http://route_waypoint_service:8003

user_service:
image: bogdanpolygalov/hse-sa-microservice:user_service
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ services:
- ./gateway_service/:/app/
ports:
- "8001:8001"
environment:
- USER_SERVICE_URL=http://user_service:8002
- ROUTE_URL=http://route_waypoint_service:8003
- POINT_URL=http://route_waypoint_service:8003

user_service:
build: ./user_service
Expand Down
7 changes: 4 additions & 3 deletions gateway_service/app/gateway_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from fastapi import FastAPI, HTTPException
from fastapi.security import HTTPBearer
import httpx
import os

from app.Models.User import User, NewUser, EditUser
from app.Models.Route import Route, NewRoute, EditRoute
Expand All @@ -10,9 +11,9 @@
app = FastAPI()
bearer_scheme = HTTPBearer()

USER_SERVICE_URL = "http://user_service:8002/user/"
ROUTE_URL = "http://route_waypoint_service:8003/route/"
POINT_URL = "http://route_waypoint_service:8003/point/"
USER_SERVICE_URL = str(os.environ.get('USER_SERVICE_URL')) + "/user/"
ROUTE_URL = str(os.environ.get('ROUTE_URL')) + "/route/"
POINT_URL = str(os.environ.get('POINT_URL ')) + "/point/"


@app.post("/user/", response_model=User, status_code=201)
Expand Down

0 comments on commit f8e89f1

Please sign in to comment.