From 162deb99e3b4ec77a10e3b689249dd5915dbe1cc Mon Sep 17 00:00:00 2001 From: Carlos Osuna Date: Fri, 5 Jul 2024 17:52:26 +0200 Subject: [PATCH 1/2] modify guards --- src/earthkit/data/sources/fdb.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/earthkit/data/sources/fdb.py b/src/earthkit/data/sources/fdb.py index e9b7b88b6..c01a03534 100644 --- a/src/earthkit/data/sources/fdb.py +++ b/src/earthkit/data/sources/fdb.py @@ -44,12 +44,12 @@ def __init__(self, *args, stream=True, **kwargs): self.request.update(a) self.request.update(kwargs) - fdb_home = os.environ.get("FDB_HOME", None) - fdb_conf = os.environ.get("FDB5_CONFIG", None) - if fdb_home is None and fdb_conf is None: + fdb5_home = os.environ.get("FDB5_HOME", None) + fdb5_conf = os.environ.get("FDB5_CONFIG", None) + fdb5_config_file = os.environ.get("FDB5_CONFIG_FILE", None) + if fdb5_home is None or (fdb5_conf is None and fdb5_config_file is None): raise ValueError( - """Neither FDB_HOME nor FDB5_CONFIG environment variable - was set! Please define either one to access FDB. + """FDB5_HOME and either FDB5_CONFIG or FDB5_CONFIG_FILE need to be set. See: https://fields-database.readthedocs.io for details about FDB.""" ) From e01741d6eb6d293aa8d820c939cedd3bea1f8544 Mon Sep 17 00:00:00 2001 From: Carlos Osuna Date: Wed, 24 Jul 2024 14:04:53 +0200 Subject: [PATCH 2/2] soften the check --- src/earthkit/data/sources/fdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/earthkit/data/sources/fdb.py b/src/earthkit/data/sources/fdb.py index c01a03534..7982e02e0 100644 --- a/src/earthkit/data/sources/fdb.py +++ b/src/earthkit/data/sources/fdb.py @@ -47,7 +47,7 @@ def __init__(self, *args, stream=True, **kwargs): fdb5_home = os.environ.get("FDB5_HOME", None) fdb5_conf = os.environ.get("FDB5_CONFIG", None) fdb5_config_file = os.environ.get("FDB5_CONFIG_FILE", None) - if fdb5_home is None or (fdb5_conf is None and fdb5_config_file is None): + if fdb5_home is None and (fdb5_conf is None and fdb5_config_file is None): raise ValueError( """FDB5_HOME and either FDB5_CONFIG or FDB5_CONFIG_FILE need to be set. See: https://fields-database.readthedocs.io for details about FDB."""