|
10 | 10 | import logging |
11 | 11 |
|
12 | 12 | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
13 | | -from confidential_compute import ConfidentialCompute, MissingConfig, MissingInstanceProfile, AuxiliariesException, SecretAccessDenied, ApiTokenNotFound, ConfidentialComputeStartupException |
| 13 | +from confidential_compute import ConfidentialCompute, MissingConfig, MissingInstanceProfile, AuxiliariesException, OperatorKeyAccessDenied, OperatorKeyNotFound, ConfidentialComputeStartupException |
14 | 14 | from azure.keyvault.secrets import SecretClient |
15 | 15 | from azure.identity import DefaultAzureCredential, CredentialUnavailableError |
16 | 16 | from azure.core.exceptions import ResourceNotFoundError, ClientAuthenticationError |
@@ -73,30 +73,30 @@ def __set_base_urls(self): |
73 | 73 | self.configs["core_base_url"] = jdata["core_attest_url"] |
74 | 74 | self.configs["optout_base_url"] = jdata["optout_api_uri"] |
75 | 75 |
|
76 | | - def __set_api_token(self): |
| 76 | + def __set_operator_key(self): |
77 | 77 | try: |
78 | 78 | credential = DefaultAzureCredential() |
79 | 79 | kv_URL = f"https://{AzureEntryPoint.kv_name}.vault.azure.net" |
80 | 80 | secret_client = SecretClient(vault_url=kv_URL, credential=credential) |
81 | 81 | secret = secret_client.get_secret(AzureEntryPoint.secret_name) |
82 | 82 | # print(f"Secret Value: {secret.value}") |
83 | | - self.configs["api_token"] = secret.value |
| 83 | + self.configs["operator_key"] = secret.value |
84 | 84 |
|
85 | 85 | except (CredentialUnavailableError, ClientAuthenticationError) as auth_error: |
86 | 86 | logging.error(f"Read operator key, authentication error: {auth_error}") |
87 | | - raise SecretAccessDenied(self.__class__.__name__, str(auth_error)) |
| 87 | + raise OperatorKeyAccessDenied(self.__class__.__name__, str(auth_error)) |
88 | 88 | except ResourceNotFoundError as not_found_error: |
89 | 89 | logging.error(f"Read operator key, secret not found: {AzureEntryPoint.secret_name}. Error: {not_found_error}") |
90 | | - raise ApiTokenNotFound(self.__class__.__name__, str(not_found_error)) |
| 90 | + raise OperatorKeyNotFound(self.__class__.__name__, str(not_found_error)) |
91 | 91 |
|
92 | 92 |
|
93 | 93 | def _set_confidential_config(self, secret_identifier: str = None): |
94 | 94 | self.configs["skip_validations"] = os.getenv("SKIP_VALIDATIONS", "false").lower() == "true" |
95 | 95 | self.configs["debug_mode"] = os.getenv("DEBUG_MODE", "false").lower() == "true" |
96 | 96 | self.configs["environment"] = AzureEntryPoint.env_name |
97 | 97 |
|
98 | | - # set self.configs["api_token"] |
99 | | - self.__set_api_token() |
| 98 | + # set self.configs["operator_key"] |
| 99 | + self.__set_operator_key() |
100 | 100 | # set base urls from final config file |
101 | 101 | self.__set_base_urls() |
102 | 102 |
|
|
0 commit comments