Skip to content

Commit

Permalink
Environment variables for default port and bind address (#342)
Browse files Browse the repository at this point in the history
* Add env vars to override default bind address and port

* Update main.py

Prefix bind address and port with SNAPPASS_

* Update README.rst

update readme to prefix SNAPPASS_ to bind address and port

---------

Co-authored-by: Yuru Shao <[email protected]>
  • Loading branch information
Radical-Egg and yurushao authored Aug 2, 2024
1 parent 4e5fc2e commit 9e43578
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ need to change this.

``HOST_OVERRIDE``: (optional) Used to override the base URL if the app is unaware. Useful when running behind reverse proxies like an identity-aware SSO. Example: ``sub.domain.com``

``SNAPPASS_BIND_ADDRESS``: (optional) Used to override the default bind address of 0.0.0.0 for flask app Example: ``127.0.0.1``

``SNAPPASS_PORT``: (optional) Used to override the default port of 5000 Example: ``6000``

APIs
----

Expand Down
3 changes: 2 additions & 1 deletion snappass/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ def health_check():

@check_redis_alive
def main():
app.run(host='0.0.0.0')
app.run(host=os.environ.get('SNAPPASS_BIND_ADDRESS', '0.0.0.0'),
port=os.environ.get('SNAPPASS_PORT', 5000))


if __name__ == '__main__':
Expand Down

0 comments on commit 9e43578

Please sign in to comment.