|
1 | 1 | from .apn_handler import TokenCredentials
|
2 |
| -from settings import getenv |
| 2 | +from utils import getenv |
3 | 3 |
|
4 | 4 |
|
5 | 5 | class PushConfig:
|
| 6 | + """ |
| 7 | + A class representing the configuration for push notifications. |
| 8 | + """ |
6 | 9 | AUTH_KEY_PATH: str | None = None
|
7 | 10 | AUTH_KEY_ID: str | None = None
|
8 | 11 | TEAM_ID: str | None = None
|
9 | 12 | APNS_APP_BUNDLE_ID: str | None = None
|
10 | 13 |
|
11 | 14 | @classmethod
|
12 | 15 | def get_auth_key_path(cls) -> str:
|
| 16 | + """ |
| 17 | + Returns the path to the authentication key for APNS. |
| 18 | + """ |
13 | 19 | if not cls.AUTH_KEY_PATH:
|
14 | 20 | cls.AUTH_KEY_PATH = getenv("APNS_AUTH_KEY_PATH")
|
15 | 21 | return cls.AUTH_KEY_PATH
|
16 | 22 |
|
17 | 23 | @classmethod
|
18 | 24 | def get_auth_key_id(cls) -> str:
|
| 25 | + """ |
| 26 | + Returns the ID of the authentication key for APNS. |
| 27 | + """ |
19 | 28 | if not cls.AUTH_KEY_ID:
|
20 | 29 | cls.AUTH_KEY_ID = getenv("APNS_KEY_ID")
|
21 | 30 | return cls.AUTH_KEY_ID
|
22 | 31 |
|
23 | 32 | @classmethod
|
24 | 33 | def get_team_id(cls) -> str:
|
| 34 | + """ |
| 35 | + Returns the team ID for APNS. |
| 36 | + """ |
25 | 37 | if not cls.TEAM_ID:
|
26 | 38 | cls.TEAM_ID = getenv("APNS_TEAM_ID")
|
27 | 39 | return cls.TEAM_ID
|
28 | 40 |
|
29 | 41 | @classmethod
|
30 | 42 | def get_apns_app_bundle_id(cls) -> str:
|
| 43 | + """ |
| 44 | + Returns the bundle ID for the APNS app. |
| 45 | + """ |
31 | 46 | if not cls.APNS_APP_BUNDLE_ID:
|
32 | 47 | cls.APNS_APP_BUNDLE_ID = getenv("APNS_APP_BUNDLE_ID")
|
33 | 48 | return cls.APNS_APP_BUNDLE_ID
|
34 | 49 |
|
35 | 50 | @classmethod
|
36 | 51 | def get_token_credentials(cls) -> TokenCredentials:
|
| 52 | + """ |
| 53 | + Returns the token credentials for APNS. |
| 54 | + """ |
37 | 55 | return TokenCredentials(
|
38 | 56 | auth_key_path=cls.get_auth_key_path(),
|
39 | 57 | auth_key_id=cls.get_auth_key_id(),
|
|
0 commit comments