Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: off url from env #22

Merged
merged 3 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ MEM_LIMIT=4294967296

# on dev connect to the same network as off-server
COMMON_NET_NAME=po_default
OPENFOODFACTS_API_URL=http://world.openfoodfacts.localhost
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ livecheck:

build:
@echo "🥫 building docker (for dev)"
docker-compose build
docker-compose build
14 changes: 6 additions & 8 deletions app/import_queue/product_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@


class ProductClient:

def __init__(self):
pass
self.server_url = os.getenv(
'OPENFOODFACTS_API_URL',
'https://world.openfoodfacts.org',
)

def get_product(self, code):
url = '{}/api/v2/product/{}'.format(
os.getenv(
'OPENFOODFACTS_API_URL',
'https://world.openfoodfacts.org',
),
code,
)
url = f'{self.server_url}/api/v2/product/{code}'
response = requests.get(url)
json_response = response.json()
if not json_response or not json_response.get('product'):
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ services:
environment:
- ELASTICSEARCH_URL=es01:9200
- REDIS_HOST=searchredis
- OPENFOODFACTS_API_URL
# make it easier to run scripts
- PYTHONPATH=/code
ports:
Expand Down
1 change: 1 addition & 0 deletions docker/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ services:
volumes:
# mount code dynamically
- "./app:/code/app"
command: ["uvicorn", "app.api:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "8000", "--reload"]
2 changes: 1 addition & 1 deletion docker/elasticvue-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ then
sed -i "/^ *access_log .*/r /tmp/nginx_snipet" $NGINX_CONF
fi

exec "$@"
exec "$@"
2 changes: 1 addition & 1 deletion docker/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ volumes:
networks:
common_net:
name: ${COMMON_NET_NAME}
external: true
external: true