From 843a670b9305c4e5f18a1c1ad5feca12344b0f2f Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Wed, 6 Dec 2023 09:14:03 +0000 Subject: [PATCH] Generate signing keys for dev launcher --- .devcontainer/dev_launcher | 4 ++++ tests/fixtures/auth_keys.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/fixtures/auth_keys.py diff --git a/.devcontainer/dev_launcher b/.devcontainer/dev_launcher index b587e80..4af218d 100755 --- a/.devcontainer/dev_launcher +++ b/.devcontainer/dev_launcher @@ -1,3 +1,7 @@ #!/bin/bash +set -a +. <(python tests/fixtures/auth_keys.py) +set +a + wps run-rest diff --git a/tests/fixtures/auth_keys.py b/tests/fixtures/auth_keys.py new file mode 100644 index 0000000..0ea421e --- /dev/null +++ b/tests/fixtures/auth_keys.py @@ -0,0 +1,31 @@ +# Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln +# for the German Human Genome-Phenome Archive (GHGA) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""Generate signing keys for testing""" + +from ghga_service_commons.utils.jwt_helpers import generate_jwk + + +def print_key_env() -> None: + """Print environment setting for the auth key.""" + auth_key = generate_jwk().export(private_key=False) + print(f"WPS_AUTH_KEY={auth_key!r}") + wps_key = generate_jwk().export(private_key=True) + print(f"WPS_WORK_PACKAGE_SIGNING_KEY={wps_key!r}") + + +if __name__ == "__main__": + print_key_env()