opendatacube / datacube-core

Open Data Cube analyses continental scale Earth Observation data through time
http://www.opendatacube.org
Apache License 2.0
493 stars 175 forks source link

Refine default behaviour of config engine to support easier migration from 1.8 #1573

Closed SpacemanPaul closed 2 months ago

SpacemanPaul commented 2 months ago

Reason for this pull request

Previously when:

  1. no config file exists in the search path (or the config file does not defined a default or datacube environment); and
  2. config is being passed in with the legacy $DB_* environment variables; and
  3. no environment is explicitly nominated:

a ConfigException was raised.

This is a very common scenario in existing 1.8.x ODC applications, and throwing an error is unexpected behaviour that makes migration from 1.8 to 1.9 more complex than it needs to be.

Proposed changes

When:

  1. no config file exists in the search path (or the config file does not define a default or datacube environment); and
  2. no environment is explicitly nominated:

The environment now defaults to default on the assumption that configuration will be available in the next step via environment variables.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.58%. Comparing base (9561764) to head (bedf264).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop-1.9 #1573 +/- ## ============================================ Coverage 85.58% 85.58% ============================================ Files 140 140 Lines 15384 15384 ============================================ Hits 13167 13167 Misses 2217 2217 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.