Skip to content

Commit

Permalink
Add host Docker environment variables to Dockerfile and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilrybacki committed Apr 23, 2024
1 parent 19bb215 commit b053196
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ WORKDIR /app

USER ppeagent

ENV PPE_AGENT_IS_DOCKERIZED=1

CMD ["python", "serve.py"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Below is a list of **environment variables** that control the main settings of t

#### Optional

* `PPE_AGENT_HOST` - Hostname on which the application will listen for incoming requests (default: `'127.0.0.1'` on local deployments, `'0.0.0.0'` in Docker containers)
* `PPE_AGENT_PORT` - Port on which the application will listen for incoming requests (default: 8000)
* `PPE_AGENT_CONFIG` - path to the configuration file (default: `''` i.e. reads hardcoded defaults)

Expand Down
1 change: 1 addition & 0 deletions src/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def main():
server = ThreadedPPEServer({
'app': ppe_agent._app, # pylint: disable=protected-access
'port': int(os.getenv('PPE_AGENT_PORT', '8000')),
'host': '0.0.0.0' if os.getenv('PPE_AGENT_IS_DOCKERIZED') else os.getenv('PPE_AGENT_HOST', '127.0.0.1'),
'log_config': ppe_agent._log_config # pylint: disable=protected-access
})
try:
Expand Down

0 comments on commit b053196

Please sign in to comment.