Module config¶
get_DB_VARS()
¶
Retrieve the database configuration variables from the environment.
This function loads the environment variables and retrieves the following database configuration variables: - DB_HOST: The hostname for the database. - DB_NAME: The name of the database. - DB_LOGS: A flag indicating if logging is enabled.
Returns:
| Type | Description |
|---|---|
Tuple[Optional[str], Optional[str], Optional[str]]
|
Tuple[Optional[str], Optional[str], Optional[str]]: A tuple containing (DB_HOST, DB_NAME, DB_LOGS). |
Source code in nbs/config.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
get_RSS_URL()
¶
Récupère l'URL du flux RSS à partir des variables d'environnement.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
L'URL du flux RSS. Si la variable d'environnement |
str
|
retourne une URL par défaut. |
Source code in nbs/config.py
32 33 34 35 36 37 38 39 40 41 42 43 44 | |
get_WEB_filename()
¶
Get the filename of the WEB_LMELP file.
This function loads environment variables and retrieves the value of the
WEB_LMELP_FILENAME environment variable. If the variable is not set,
it returns a default file path.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The filename of the WEB_LMELP file. |
Source code in nbs/config.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
get_audio_path(audio_path=AUDIO_PATH, year='2024')
¶
Returns the full path to the audio files by appending the year as a subdirectory.
If the directory does not exist, it is created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio_path
|
str
|
Relative path to the audio files. |
AUDIO_PATH
|
year
|
str
|
The year used as a subdirectory (default "2024"). |
'2024'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The full path to the corresponding audio directory. |
Example
path = get_audio_path("audios", "2024")
Source code in nbs/config.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
get_azure_openai_keys()
¶
Get the Azure OpenAI keys from environment variables.
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple[str, str, str]
|
A tuple containing the Azure API key, endpoint, and API version. |
Source code in nbs/config.py
96 97 98 99 100 101 102 103 104 105 106 107 | |
get_gemini_api_key()
¶
Get the Gemini API key from environment variables.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The Gemini API key. |
Source code in nbs/config.py
48 49 50 51 52 53 54 55 56 57 | |
get_git_root(path)
¶
Retrieves the root directory of the Git repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The current working directory. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The root directory of the Git repository. |
Source code in nbs/config.py
114 115 116 117 118 119 120 121 122 123 124 | |
get_google_auth_file()
¶
Get the Google authentication file path from environment variables.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The path to the Google authentication file. |
Source code in nbs/config.py
84 85 86 87 88 89 90 91 92 93 | |
get_google_projectID()
¶
Get the Google Project ID from environment variables.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The Google Project ID. |
Source code in nbs/config.py
72 73 74 75 76 77 78 79 80 81 | |
get_openai_api_key()
¶
Get the OpenAI API key from environment variables.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The OpenAI API key. |
Source code in nbs/config.py
60 61 62 63 64 65 66 67 68 69 | |
load_env()
¶
Charge les variables d'environnement à partir d'un fichier .env.
Source code in nbs/config.py
24 25 26 27 28 | |