Skip to content

Commit

Permalink
Issue #117 add a minimal dummy config to use by default
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Sep 21, 2023
1 parent bf9373c commit 1d29b43
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ variant of this application config:
- `conf/aggregator.prod.py`

Use the env var `OPENEO_AGGREGATOR_CONFIG` to point to the desired config path.
Currently, the dev config is used as fallback.
By default, `conf/aggregator.dummy.py` is loaded.

Also note that these concrete config files will be refactored out of the `openeo-aggregator` repo
at some point in the future ([#117](https://github.com/Open-EO/openeo-aggregator/issues/117))
Expand Down
23 changes: 23 additions & 0 deletions conf/aggregator.dummy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Dummy/example config
"""
from openeo_driver.users.oidc import OidcProvider

from openeo_aggregator.config import AggregatorConfig

config = AggregatorConfig(
config_source=__file__,
aggregator_backends={
"dummy": "https://openeo.example/openeo/1.1/",
},
configured_oidc_providers=[
OidcProvider(
id="egi",
title="EGI Check-in",
issuer="https://aai.egi.eu/auth/realms/egi/",
scopes=["openid"],
),
],
auth_entitlement_check=False,
zookeeper_prefix="/openeo/aggregator/dummy/",
)
4 changes: 2 additions & 2 deletions src/openeo_aggregator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def copy(self) -> 'AggregatorConfig':

def get_config_dir() -> Path:
# TODO: make this robust against packaging operations (e.g. no guaranteed real __file__ path)
# TODO #117: eliminate the need for this hardcoded, package based config dir
for root in [Path.cwd(), Path(__file__).parent.parent.parent]:
config_dir = root / "conf"
if config_dir.is_dir():
Expand All @@ -96,8 +97,7 @@ def get_config(x: Union[str, Path, AggregatorConfig, None] = None) -> Aggregator
x = os.environ[OPENEO_AGGREGATOR_CONFIG]
_log.info(f"Config from env var {OPENEO_AGGREGATOR_CONFIG}: {x!r}")
else:
# TODO #117 provide just a very simple default config, instead of a concrete dev one
x = get_config_dir() / "aggregator.dev.py"
x = get_config_dir() / "aggregator.dummy.py"
_log.info(f"Config from fallback {x!r}")

if isinstance(x, str):
Expand Down

0 comments on commit 1d29b43

Please sign in to comment.