Skip to content

Commit

Permalink
Show token when running dev launcher (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored Jul 22, 2024
1 parent 0991487 commit 26cb9ec
Show file tree
Hide file tree
Showing 8 changed files with 347 additions and 604 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
ARS_CONFIG_YAML: /workspace/.devcontainer/.dev_config.yaml

mongodb:
image: mongo:7.0.7
image: mongo:7.0.12
restart: unless-stopped
volumes:
- mongo_fs:/data/db
Expand All @@ -44,14 +44,14 @@ services:
ME_CONFIG_MONGODB_URL: mongodb://mongodb:27017/

zookeeper:
image: confluentinc/cp-zookeeper:7.5.1
image: confluentinc/cp-zookeeper:7.6.2
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000

kafka:
image: confluentinc/cp-server:7.5.1
image: confluentinc/cp-server:7.6.2
restart: unless-stopped
depends_on:
- zookeeper
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
- id: no-commit-to-branch
args: [--branch, dev, --branch, int, --branch, main]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
rev: v0.5.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
557 changes: 212 additions & 345 deletions lock/requirements-dev.txt

Large diffs are not rendered by default.

361 changes: 112 additions & 249 deletions lock/requirements.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/ars/adapters/outbound/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def construct(
async with httpx.AsyncClient(timeout=TIMEOUT) as client:
yield cls(config=config, client=client)

async def grant_download_access( # noqa: PLR0913
async def grant_download_access(
self,
user_id: str,
iva_id: str,
Expand Down
2 changes: 1 addition & 1 deletion src/ars/ports/outbound/access_grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AccessGrantsInvalidPeriodError(AccessGrantsError):
"""Raised when there was an error in the validity period."""

@abstractmethod
async def grant_download_access( # noqa: PLR0913
async def grant_download_access(
self,
user_id: str,
iva_id: str,
Expand Down
2 changes: 0 additions & 2 deletions tests/fixtures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@
"email": "[email protected]",
"title": "Dr.",
"id": "[email protected]",
"status": "active",
}

AUTH_CLAIMS_STEWARD = {
"name": "Rod Steward",
"email": "[email protected]",
"id": "[email protected]",
"status": "active",
"role": "[email protected]",
}

Expand Down
19 changes: 17 additions & 2 deletions tests/fixtures/auth_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,29 @@

"""Generate signing keys for testing"""

from ghga_service_commons.utils.jwt_helpers import generate_jwk
from ghga_service_commons.utils.jwt_helpers import (
generate_jwk,
sign_and_serialize_token,
)

ARS_AUTH_KEY = generate_jwk().export(private_key=False)
AUTH_CLAIMS_STEWARD = {
"name": "Rod Steward",
"email": "[email protected]",
"id": "[email protected]",
"role": "[email protected]",
}

AUTH_KEY_PAIR = generate_jwk()

ARS_AUTH_KEY = AUTH_KEY_PAIR.export(private_key=False)

TOKEN = sign_and_serialize_token(AUTH_CLAIMS_STEWARD, AUTH_KEY_PAIR)


def print_auth_key_env() -> None:
"""Print environment setting for the auth key."""
print(f"{ARS_AUTH_KEY=!r}")
print("echo Bearer token:", TOKEN)


if __name__ == "__main__":
Expand Down

0 comments on commit 26cb9ec

Please sign in to comment.