Skip to content

Commit

Permalink
Updating documentation examples to include NGROK_AUTHTOKEN usage, sin…
Browse files Browse the repository at this point in the history
…ce that is required now.
  • Loading branch information
alexdlaird committed Jan 22, 2024
1 parent 59eb458 commit 6301255
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/alexdlaird/pyngrok/compare/7.0.5...HEAD)
### Added
- Documentation improvements.
- Test improvements.

## [7.0.5](https://github.com/alexdlaird/pyngrok/compare/7.0.4...7.0.5) - 2023-12-30
### Fixed
Expand Down
16 changes: 8 additions & 8 deletions docs/integrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ same place.
USE_NGROK=os.environ.get("USE_NGROK", "False") == "True" and os.environ.get("WERKZEUG_RUN_MAIN") != "true"
)
if app.config["USE_NGROK"]:
if app.config["USE_NGROK"] and os.environ.get("NGROK_AUTHTOKEN"):
# pyngrok will only be installed, and should only ever be initialized, in a dev environment
from pyngrok import ngrok
Expand All @@ -59,7 +59,7 @@ Now Flask can be started in development by the usual means, setting ``USE_NGROK`

.. code-block:: sh
USE_NGROK=True FLASK_APP=server.py flask run
USE_NGROK=True NGROK_AUTHTOKEN=<AUTHTOKEN> FLASK_APP=server.py flask run
Django
------
Expand Down Expand Up @@ -101,7 +101,7 @@ to do this is one of our ``apps.py`` by `extending AppConfig <https://docs.djang
verbose_name = "Common"
def ready(self):
if settings.DEV_SERVER and settings.USE_NGROK:
if settings.DEV_SERVER and settings.USE_NGROK and os.environ.get("NGROK_AUTHTOKEN"):
# pyngrok will only be installed, and should only ever be initialized, in a dev environment
from pyngrok import ngrok
Expand All @@ -127,7 +127,7 @@ Now the Django dev server can be started by the usual means, setting ``USE_NGROK

.. code-block:: sh
USE_NGROK=True python manage.py runserver
USE_NGROK=True NGROK_AUTHTOKEN=<AUTHTOKEN> python manage.py runserver
FastAPI
-------
Expand Down Expand Up @@ -166,7 +166,7 @@ we should add a variable that let's us configure from an environment variable wh
# Initialize the FastAPI app for a simple web server
app = FastAPI()
if settings.USE_NGROK:
if settings.USE_NGROK and os.environ.get("NGROK_AUTHTOKEN"):
# pyngrok should only ever be installed or initialized in a dev environment when this flag is set
from pyngrok import ngrok
Expand All @@ -189,7 +189,7 @@ Now FastAPI can be started by the usual means, with `Uvicorn <https://www.uvicor

.. code-block:: sh
USE_NGROK=True uvicorn server:app
USE_NGROK=True NGROK_AUTHTOKEN=<AUTHTOKEN> uvicorn server:app
Google Colaboratory
-------------------
Expand Down Expand Up @@ -411,7 +411,7 @@ We can then run this script to start the server.

.. code-block:: sh
python server.py
NGROK_AUTHTOKEN=<AUTHTOKEN> python server.py
Python TCP Server and Client
----------------------------
Expand Down Expand Up @@ -480,7 +480,7 @@ In a terminal window, we can now start our socket server:

.. code-block:: sh
HOST="1.tcp.ngrok.io" PORT=12345 python server.py
NGROK_AUTHTOKEN=<AUTHTOKEN> HOST="1.tcp.ngrok.io" PORT=12345 python server.py
It's now waiting for incoming connections, so let's write a client to connect to it and send it something.

Expand Down

0 comments on commit 6301255

Please sign in to comment.