diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 07edaef..d512479 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,10 +1,12 @@ -name: Pylint +name: Linting on: push: + branches: + - main pull_request: branches: - - master + - main jobs: build: diff --git a/README.md b/README.md index 3a68f7a..4b1ec23 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,32 @@ It is based on the [customerinsights](https://pypi.org/project/customerinsights) segments : Commands to manage segments. ``` +1. Get help on any command with `--help`: + + ```bash + > aui-cli instances list --help + + Command + aui-cli instances list : Lists all instances. + + Arguments + + Global Arguments + --debug : Increase logging verbosity to show all debug logs. + --help -h : Show this help message and exit. + --only-show-errors : Only show errors, suppressing warnings. + --output -o : Output format. Allowed values: json, jsonc, none, table, tsv, yaml, yamlc. + Default: json. + --query : JMESPath query string. See http://jmespath.org/ for more information and + examples. + --verbose : Increase logging verbosity. Use --debug for full debug logs. + ``` + ## Configuration -Add the `api_key` and OAuth token in the file `~/.aui-cli/config` +All configuration values are stored in the file `~/.aui-cli/config`, automatically created the first time the application is run. + +In the `[autentication]` section, add your `api_key` and OAuth token: ```text [authentication] @@ -55,6 +78,13 @@ api_key = REDACTED token = REDACTED ``` +An alternate base url (default is `https://api.ci.ai.dynamics.com/v1`) can be defined in the `[endpoint]` section: + +```text +[endpoint] +base_url = https://api.ci.ai.dynamics-alternate.com/v1 +``` + ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). diff --git a/src/aui_cli/common/services.py b/src/aui_cli/common/services.py index 35ee9df..8b90dc7 100644 --- a/src/aui_cli/common/services.py +++ b/src/aui_cli/common/services.py @@ -4,15 +4,21 @@ # -------------------------------------------------------------------------------------------- from dynamics.customerinsights.api import CustomerInsights +from knack.log import get_logger from .config import GLOBAL_CONFIG +logger = get_logger(__name__) + def get_client(): """ Returns an authenticated CustomerInsights client. """ - return CustomerInsights() + base_url = GLOBAL_CONFIG.get("endpoint", "base_url", None) + if base_url: + logger.info('Using base url: %s', base_url) + return CustomerInsights(base_url) def get_custom_headers():