Skip to content

Commit

Permalink
Update warning log to use log_deprecation
Browse files Browse the repository at this point in the history
Update config handling to support `api_services` config outside of `keys` since #98 enabled more configuration options
  • Loading branch information
NeonDaniel committed Aug 29, 2024
1 parent d6bf6bd commit a602463
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 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,14 @@ 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.",
"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

0 comments on commit a602463

Please sign in to comment.