diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f3a839..6b6c081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. + +## [0.7.1] - 2023-01-10 + +### Bugfix + +- Keyword arguments fixed, host -> databaseAddress and user -> username PR [#149] (https://github.com/datajoint/pharus/pull/149) + ## [0.7.0] - 2023-01-05 ### Added @@ -242,6 +249,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and - Support for DataJoint attribute types: `varchar`, `int`, `float`, `datetime`, `date`, `time`, `decimal`, `uuid`. - Check dependency utility to determine child table references. +[0.7.1]: https://github.com/datajoint/pharus/compare/0.7.0...0.7.1 [0.7.0]: https://github.com/datajoint/pharus/compare/0.6.4...0.7.0 [0.6.4]: https://github.com/datajoint/pharus/compare/0.6.3...0.6.4 [0.6.3]: https://github.com/datajoint/pharus/compare/0.6.2...0.6.3 diff --git a/README.rst b/README.rst index e9d988d..965e5b3 100644 --- a/README.rst +++ b/README.rst @@ -29,13 +29,13 @@ To start the API server, use the command: .. code-block:: bash - PHARUS_VERSION=0.7.0 docker-compose -f docker-compose-deploy.yaml up -d + PHARUS_VERSION=0.7.1 docker-compose -f docker-compose-deploy.yaml up -d To stop the API server, use the command: .. code-block:: bash - PHARUS_VERSION=0.7.0docker-compose -f docker-compose-deploy.yaml down + PHARUS_VERSION=0.7.1 docker-compose -f docker-compose-deploy.yaml down References ---------- diff --git a/docker-compose-deploy.yaml b/docker-compose-deploy.yaml index 77812d7..5f35125 100644 --- a/docker-compose-deploy.yaml +++ b/docker-compose-deploy.yaml @@ -1,5 +1,5 @@ -# PHARUS_VERSION=0.7.0 docker-compose -f docker-compose-deploy.yaml pull -# PHARUS_VERSION=0.7.0 docker-compose -f docker-compose-deploy.yaml up -d +# PHARUS_VERSION=0.7.1 docker-compose -f docker-compose-deploy.yaml pull +# PHARUS_VERSION=0.7.1 docker-compose -f docker-compose-deploy.yaml up -d # # Intended for production deployment. # Note: You must run both commands above for minimal outage diff --git a/pharus/server.py b/pharus/server.py index 0fd35c7..2afec12 100644 --- a/pharus/server.py +++ b/pharus/server.py @@ -68,8 +68,8 @@ def wrapper(**kwargs): if "database_host" in request.args: encoded_jwt = request.headers.get("Authorization").split()[1] connect_creds = { - "host": request.args["database_host"], - "user": jwt.decode( + "databaseAddress": request.args["database_host"], + "username": jwt.decode( encoded_jwt, crypto_serialization.load_der_public_key( b64decode(environ.get("PHARUS_OIDC_PUBLIC_KEY").encode()) @@ -86,8 +86,8 @@ def wrapper(**kwargs): algorithms="RS256", ) connection = dj.Connection( - host=connect_creds["host"], - user=connect_creds["user"], + host=connect_creds["databaseAddress"], + user=connect_creds["username"], password=connect_creds["password"], ) return function(connection, **kwargs) @@ -126,7 +126,7 @@ def api_version() -> str: Content-Type: application/json { - "version": "0.7.0" + "version": "0.7.1" } :statuscode 200: No error. @@ -173,8 +173,8 @@ def login() -> dict: Accept: application/json { - "host": "tutorial-db.datajoint.io", - "user": "user1", + "databaseAddress": "tutorial-db.datajoint.io", + "username": "user1", "password": "password1" } @@ -237,8 +237,8 @@ def login() -> dict: ) time.sleep(1) connect_creds = { - "host": request.args["database_host"], - "user": jwt.decode( + "databaseAddress": request.args["database_host"], + "username": jwt.decode( auth_info["jwt"], crypto_serialization.load_der_public_key( b64decode(environ.get("PHARUS_OIDC_PUBLIC_KEY").encode()) @@ -256,12 +256,12 @@ def login() -> dict: ) ) connect_creds = request.json - if connect_creds.keys() < {"host", "user", "password"}: + if connect_creds.keys() < {"databaseAddress", "username", "password"}: return dict(error="Invalid Request, check headers and/or json body") try: dj.Connection( - host=connect_creds["host"], - user=connect_creds["user"], + host=connect_creds["databaseAddress"], + user=connect_creds["username"], password=connect_creds["password"], ) except pymysql.err.OperationalError as e: @@ -276,8 +276,8 @@ def login() -> dict: password=root_password, ).query("FLUSH PRIVILEGES") dj.Connection( - host=connect_creds["host"], - user=connect_creds["user"], + host=connect_creds["databaseAddress"], + user=connect_creds["username"], password=connect_creds["password"], ) else: diff --git a/pharus/version.py b/pharus/version.py index 98ba644..9359be4 100644 --- a/pharus/version.py +++ b/pharus/version.py @@ -1,2 +1,2 @@ """Package metadata.""" -__version__ = "0.7.0" +__version__ = "0.7.1" diff --git a/tests/__init__.py b/tests/__init__.py index 5fe5243..ddfab1b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -26,8 +26,8 @@ def token(client): yield client.post( "/login", json=dict( - host=getenv("TEST_DB_SERVER"), - user=getenv("TEST_DB_USER"), + databaseAddress=getenv("TEST_DB_SERVER"), + username=getenv("TEST_DB_USER"), password=getenv("TEST_DB_PASS"), ), ).json["jwt"] @@ -47,8 +47,8 @@ def group1_token(client, connection): yield client.post( "/login", json=dict( - host=getenv("TEST_DB_SERVER"), - user="group1", + databaseAddress=getenv("TEST_DB_SERVER"), + username="group1", password="group1", ), ).json["jwt"]