diff --git a/ip_listener/__init__.py b/ip_listener/__init__.py index e69de29..13bb1c6 100644 --- a/ip_listener/__init__.py +++ b/ip_listener/__init__.py @@ -0,0 +1,7 @@ +from pathlib import Path + +from dotenv import load_dotenv + +env_path = Path("..") / ".env" + +load_dotenv(dotenv_path=env_path) diff --git a/ip_listener/cli.py b/ip_listener/cli.py index 08bddd9..8fe6ffb 100644 --- a/ip_listener/cli.py +++ b/ip_listener/cli.py @@ -4,6 +4,8 @@ from ip_listener.main import detect @click.command() -@click.argument() -def run(): - detect() +@click.argument("domains", envvar="DOMAIN", nargs=-1) +@click.argument("token", envvar="TOKEN") +@click.option("--read-only", envvar="READ_ONLY", default=False) +def run(domains, token): + detect(domains, token) diff --git a/poetry.lock b/poetry.lock index 0128bdd..2b43d23 100644 --- a/poetry.lock +++ b/poetry.lock @@ -84,6 +84,17 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +[[package]] +name = "python-dotenv" +version = "0.15.0" +description = "Add .env support to your django/flask apps in development and deployments" +category = "main" +optional = false +python-versions = "*" + +[package.extras] +cli = ["click (>=5.0)"] + [[package]] name = "regex" version = "2020.11.13" @@ -119,7 +130,7 @@ python-versions = "*" [metadata] lock-version = "1.0" python-versions = "^3.7" -content-hash = "7bf49667b7bd270cfd8e9773ac7d6d5cbfbbc55b60b8b2b569eb6bea6a288349" +content-hash = "94aba70614582f8f382aa70da21bde6f0b851c650646027f17cb04012b2082bd" [metadata.files] appdirs = [ @@ -152,6 +163,10 @@ pyflakes = [ {file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"}, {file = "pyflakes-2.2.0.tar.gz", hash = "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"}, ] +python-dotenv = [ + {file = "python-dotenv-0.15.0.tar.gz", hash = "sha256:587825ed60b1711daea4832cf37524dfd404325b7db5e25ebe88c495c9f807a0"}, + {file = "python_dotenv-0.15.0-py2.py3-none-any.whl", hash = "sha256:0c8d1b80d1a1e91717ea7d526178e3882732420b03f08afea0406db6402e220e"}, +] regex = [ {file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"}, {file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"}, diff --git a/pyproject.toml b/pyproject.toml index dbf1407..83e1e14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ license = "GPL-3.0" [tool.poetry.dependencies] python = "^3.7" click = "^7.1.2" +python-dotenv = "^0.15.0" [tool.poetry.dev-dependencies] black = "^20.8b1"