Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update configuration handling #99

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,36 @@ jobs:
run: |
pytest tests/test_cached_api.py --doctest-modules --junitxml=tests/cached-api-test-results.xml
- name: Upload cached API test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: cached-api-test-results
name: cached-api-test-results-${{matrix.python-version}}
path: tests/cached-api-test-results.xml

- name: Test Wolfram API
run: |
pytest tests/test_wolfram_api.py --doctest-modules --junitxml=tests/wolfram-api-test-results.xml
- name: Upload Wolfram API test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: wolfram-api-test-results
name: wolfram-api-test-results-${{matrix.python-version}}
path: tests/wolfram-api-test-results.xml

- name: Test Alpha Vantage API
run: |
pytest tests/test_alpha_vantage_api.py --doctest-modules --junitxml=tests/alphavantage-api-test-results.xml
- name: Upload Alpha Vantage API test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: alphavantage-api-test-results
name: alphavantage-api-test-results-${{matrix.python-version}}
path: tests/alphavantage-api-test-results.xml

- name: Test OWM API
run: |
pytest tests/test_owm_api.py --doctest-modules --junitxml=tests/owm-api-test-results.xml
- name: Upload Open Weather Map API test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: owm-api-test-results
name: owm-api-test-results-${{matrix.python-version}}
path: tests/owm-api-test-results.xml

- name: Test Map Maker API
Expand All @@ -92,16 +92,16 @@ jobs:
env:
MAP_MAKER_KEY: ${{secrets.map_maker_key}}
- name: Upload Map Maker API test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: map-maker-api-test-results
name: map-maker-api-test-results-${{matrix.python-version}}
path: tests/map-maker-api-test-results.xml

- name: Test Generic API
run: |
pytest tests/test_generic_controller.py --doctest-modules --junitxml=tests/generic-controller-test-results.xml
- name: Upload Generic API test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: generic-controller-test-results
name: generic-controller-test-results-${{matrix.python-version}}
path: tests/generic-controller-test-results.xml
12 changes: 9 additions & 3 deletions neon_api_proxy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from os.path import join, isfile
from ovos_utils.log import LOG
from ovos_utils.log import LOG, log_deprecation
from ovos_config.config import Configuration
from neon_utils.configuration_utils import NGIConfig
from ovos_config.locations import get_xdg_config_save_path
Expand Down Expand Up @@ -70,10 +70,16 @@ def _init_config() -> dict:
legacy_config_file = join(get_xdg_config_save_path(),
"ngi_auth_vars.yml")
if isfile(legacy_config_file):
LOG.warning(f"Legacy configuration found at: {legacy_config_file}")
log_deprecation(f"Legacy configuration found at: {legacy_config_file}. "
f"This will be ignored in future versions. "
f"Default configuration handling will use "
f"~/.config/neon/diana.yaml.",
"1.0.0")
return NGIConfig("ngi_auth_vars").get("api_services") or dict()
else:
return Configuration().get("keys", {}).get("api_services") or dict()
config = Configuration()
return config.get("keys", {}).get("api_services") or \
config.get("api_services") or dict()

def init_service_instances(self, service_class_mapping: dict) -> dict:
"""
Expand Down
Loading