diff --git a/README.md b/README.md index 4378fd8..00a1449 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,10 @@ $ ColabCode() # - port: the port you want to run code-server on, default 10000 # - password: password to protect your code server from being accessed by someone else. Note that there is no password by default! # - mount_drive: True or False to mount your Google Drive +# - region: us(default) - United States, eu - Europe, ap - Asia/Pacific, au - Australia, sa - South America, jp - Japan, in - India -$ ColabCode(port=10000, password="abhishek", mount_drive=True) + +$ ColabCode(port=10000, password="abhishek", mount_drive=True, region="in") ``` ## How to use it? Colab starter notebook: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/abhishekkrthakur/colabcode/blob/master/colab_starter.ipynb) diff --git a/colabcode/code.py b/colabcode/code.py index 3df0dcc..240594a 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -4,7 +4,7 @@ import nest_asyncio import uvicorn -from pyngrok import ngrok +from pyngrok import ngrok, conf try: @@ -26,6 +26,7 @@ def __init__( password=None, authtoken=None, mount_drive=False, + region="us", code=True, lab=False, ): @@ -33,6 +34,7 @@ def __init__( self.password = password self.authtoken = authtoken self._mount = mount_drive + self.region = region self._code = code self._lab = lab if self._lab: @@ -60,6 +62,7 @@ def _install_extensions(): subprocess.run(["code-server", "--install-extension", f"{ext}"]) def _start_server(self): + conf.get_default().region = self.region if self.authtoken: ngrok.set_auth_token(self.authtoken) active_tunnels = ngrok.get_tunnels()