ftest-common-py/ftest_common/env.py

23 lines
633 B
Python
Raw Normal View History

# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
import os
from .logger import logger
def get_env(name) -> str:
env = FTEST_AUTH = os.environ.get(name)
logger.info(f"Environment: {name}: {env}")
if env is None:
raise Exception(
f"Please set environment variable {name}. See https://git.batsense.net/ForgeFlux/nodeinfo-test#environment-variables"
)
return env
FTEST_AUTH = get_env("FTEST_AUTH")
FTEST_HOST = get_env("FTEST_HOST")
FTEST_USER = get_env("FTEST_USER")
TARGET_HOST = get_env("FTEST_TARGET_HOST")