-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsettings.py
More file actions
510 lines (395 loc) · 13.8 KB
/
settings.py
File metadata and controls
510 lines (395 loc) · 13.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
import os
import typing
IS_DEBUG_LOG_LEVEL: bool = os.getenv("TESTGEN_DEBUG_LOG_LEVEL", "no").lower() == "yes"
"""
When set, logs will be at debug level.
defaults to: `no`
"""
IS_DEBUG: bool = os.getenv("TESTGEN_DEBUG", "no").lower() == "yes"
"""
When True invalidates the cache with the bootstrapped application
causing the changes to the routing and plugins to take effect on every
render.
from env variable: `TESTGEN_DEBUG`
defaults to: `True`
"""
LOG_TO_FILE: bool = os.getenv("TESTGEN_LOG_TO_FILE", "yes").lower() == "yes"
"""
When set, rotating file logs will be generated.
defaults to: `True`
"""
LOG_FILE_PATH: str = os.getenv("TESTGEN_LOG_FILE_PATH", "/var/lib/testgen/log")
"""
When set, rotating file logs will be generated under this path.
"""
LOG_FILE_MAX_QTY: str = os.getenv("TESTGEN_LOG_FILE_MAX_QTY", "90")
"""
Maximum log files to keep, defaults to 90 days (one file per day).
"""
APP_ENCRYPTION_SALT: str = os.getenv("TG_DECRYPT_SALT")
"""
Salt used to encrypt and decrypt user secrets. Only allows ascii
characters.
A minimun length of 16 characters is recommended.
from env variable: `TG_DECRYPT_SALT`
"""
APP_ENCRYPTION_SECRET: str = os.getenv("TG_DECRYPT_PASSWORD")
"""
Secret passcode used in combination with `APP_ENCRYPTION_SALT` to
encrypt and decrypt user secrets. Only allows ascii characters.
from env variable: `TG_DECRYPT_PASSWORD`
"""
USERNAME: str = os.getenv("TESTGEN_USERNAME")
"""
Username to log into the web application
from env variable: `TESTGEN_USERNAME`
"""
PASSWORD: str = os.getenv("TESTGEN_PASSWORD")
"""
Password to log into the web application
from env variable: `TESTGEN_PASSWORD`
"""
DATABASE_USER: str = os.getenv("TG_METADATA_DB_USER", USERNAME)
"""
User to connect to the testgen application postgres database.
from env variable: `TG_METADATA_DB_USER`
defaults to: `environ[USERNAME]`
"""
DATABASE_PASSWORD: str = os.getenv("TG_METADATA_DB_PASSWORD", PASSWORD)
"""
Password to connect to the testgen application postgres database.
from env variable: `TG_METADATA_DB_PASSWORD`
defaults to: `environ[PASSWORD]`
"""
DATABASE_ADMIN_USER: str = os.getenv("DATABASE_ADMIN_USER", DATABASE_USER)
"""
User with admin privileges in the testgen application postgres database
used to create roles, users, database and schema. Required if the user
in `TG_METADATA_DB_USER` does not have the required privileges.
from env variable: `DATABASE_ADMIN_USER`
defaults to: `environ[DATABASE_USER]`
"""
DATABASE_ADMIN_PASSWORD: str = os.getenv("DATABASE_ADMIN_PASSWORD", DATABASE_PASSWORD)
"""
Password for the admin user to connect to the testgen application
postgres database.
from env variable: `DATABASE_ADMIN_PASSWORD`
defaults to: `environ[DATABASE_PASSWORD]`
"""
DATABASE_EXECUTE_USER: str = os.getenv("DATABASE_EXECUTE_USER", "testgen_execute")
"""
User to be created into the testgen application postgres database. Will
be granted:
_ read/write to tables `test_results`, `test_suites` and `test_definitions`
_ read_only to all other tables
from env variable: `DATABASE_EXECUTE_USER`
defaults to: `testgen_execute`
"""
DATABASE_REPORT_USER: str = os.getenv("DATABASE_REPORT_USER", "testgen_report")
"""
User to be created into the testgen application postgres database. Will
be granted read_only access to all tables.
from env variable: `DATABASE_REPORT_USER`
defaults to: `testgen_report`
"""
DATABASE_HOST: str = os.getenv("TG_METADATA_DB_HOST", "localhost")
"""
Hostname where the testgen application postgres database is running in.
from env variable: `TG_METADATA_DB_HOST`
defaults to: `localhost`
"""
DATABASE_PORT: str = os.getenv("TG_METADATA_DB_PORT", "5432")
"""
Port at which the testgen application postgres database is exposed by
the host.
from env variable: `TG_METADATA_DB_PORT`
defaults to: `5432`
"""
DATABASE_NAME: str = os.getenv("TG_METADATA_DB_NAME", "datakitchen")
"""
Name of the database in postgres on which to store testgen metadata.
from env variable: `TG_METADATA_DB_NAME`
defaults to: `datakitchen`
"""
DATABASE_SCHEMA: str = os.getenv("TG_METADATA_DB_SCHEMA", "testgen")
"""
Name of the schema inside the postgres database on which to store
testgen metadata.
from env variable: `TG_METADATA_DB_SCHEMA`
defaults to: `testgen`
"""
PROJECT_KEY: str = os.getenv("PROJECT_KEY", "DEFAULT")
"""
Code used to uniquely identify the auto generated project.
from env variable: `PROJECT_KEY`
defaults to: `DEFAULT`
"""
PROJECT_NAME: str = os.getenv("PROJECT_NAME", "Demo")
"""
Name to assign to the auto generated project.
from env variable: `DEFAULT_PROJECT_NAME`
defaults to: `Demo`
"""
PROJECT_SQL_FLAVOR: str = os.getenv("PROJECT_SQL_FLAVOR", "postgresql")
"""
SQL flavor of the database the auto generated project will run tests
against.
Supported flavors are:
_ redshift
_ snowflake
_ mssql
_ postgresql
from env variable: `PROJECT_SQL_FLAVOR`
defaults to: `postgresql`
"""
PROJECT_CONNECTION_NAME: str = os.getenv("PROJECT_CONNECTION_NAME", "default")
"""
Name assigned to identify the connection to the project database.
from env variable: `PROJECT_CONNECTION_NAME`
defaults to: `default`
"""
PROJECT_CONNECTION_MAX_THREADS: int = int(os.getenv("PROJECT_CONNECTION_MAX_THREADS", "4"))
"""
Maximum number of concurrent queries executed when fetching data from
the project database.
from env variable: `PROJECT_CONNECTION_MAX_THREADS`
defaults to: `4`
"""
PROJECT_CONNECTION_MAX_QUERY_CHAR: int = int(os.getenv("PROJECT_CONNECTION_MAX_QUERY_CHAR", "5000"))
"""
Determine how many tests are grouped together in a single query.
Increase for better performance or decrease to better isolate test
failures. Accepted values are 500 to 14 000.
from env variable: `PROJECT_CONNECTION_MAX_QUERY_CHAR`
defaults to: `5000`
"""
PROJECT_DATABASE_NAME: str = os.getenv("PROJECT_DATABASE_NAME", "demo_db")
"""
Name of the database the auto generated project will run test
against.
from env variable: `PROJECT_DATABASE_NAME`
defaults to: `demo_db`
"""
PROJECT_DATABASE_SCHEMA: str = os.getenv("PROJECT_DATABASE_SCHEMA", "demo")
"""
Name of the schema inside the project database the tests will be run
against.
from env variable: `PROJECT_DATABASE_SCHEMA`
defaults to: `demo`
"""
PROJECT_DATABASE_USER: str = os.getenv("PROJECT_DATABASE_USER", DATABASE_USER)
"""
User to be used by the auto generated project to connect to the database
under testing.
from env variable: `PROJECT_DATABASE_USER`
defaults to: `environ[DATABASE_USER]`
"""
PROJECT_DATABASE_PASSWORD: str = os.getenv("PROJECT_DATABASE_PASSWORD", DATABASE_PASSWORD)
"""
Password to be used by the auto generated project to connect to the
database under testing.
from env variable: `PROJECT_DATABASE_USER`
defaults to: `environ[DATABASE_PASSWORD]`
"""
PROJECT_DATABASE_HOST: str = os.getenv("PROJECT_DATABASE_HOST", DATABASE_HOST)
"""
Hostname where the database under testing is running in.
from env variable: `PROJECT_DATABASE_HOST`
defaults to: `environ[DATABASE_HOST]`
"""
PROJECT_DATABASE_PORT: str = os.getenv("PROJECT_DATABASE_PORT", DATABASE_PORT)
"""
Port at which the database under testing is exposed by the host.
from env variable: `PROJECT_DATABASE_PORT`
defaults to: `environ[DATABASE_PORT]`
"""
SKIP_DATABASE_CERTIFICATE_VERIFICATION: bool = os.getenv("TG_TARGET_DB_TRUST_SERVER_CERTIFICATE", "no").lower() == "yes"
"""
When True for supported SQL flavors, set up the SQLAlchemy connection to
trust the database server certificate.
from env variable: `TG_TARGET_DB_TRUST_SERVER_CERTIFICATE`
defaults to: `True`
"""
DEFAULT_TABLE_GROUPS_NAME: str = os.getenv("DEFAULT_TABLE_GROUPS_NAME", "default")
"""
Name assigned to the auto generated table group.
from env variable: `DEFAULT_TABLE_GROUPS_NAME`
defaults to: `default`
"""
DEFAULT_TEST_SUITE_KEY: str = os.getenv("DEFAULT_TEST_SUITE_NAME", "default-suite-1")
"""
Key to be assgined to the auto generated test suite.
from env variable: `DEFAULT_TEST_SUITE_NAME`
defaults to: `default-suite-1`
"""
DEFAULT_TEST_SUITE_DESCRIPTION: str = os.getenv("DEFAULT_TEST_SUITE_DESCRIPTION", "default_suite_desc")
"""
Description for the auto generated test suite.
from env variable: `DEFAULT_TEST_SUITE_DESCRIPTION`
defaults to: `default_suite_desc`
"""
DEFAULT_MONITOR_TEST_SUITE_KEY: str = os.getenv("DEFAULT_MONITOR_TEST_SUITE_NAME", "default-monitor-suite-1")
"""
Key to be assgined to the auto generated monitoring test suite.
from env variable: `DEFAULT_MONITOR_TEST_SUITE_NAME`
defaults to: `default-monitor-suite-1`
"""
DEFAULT_PROFILING_TABLE_SET = os.getenv("DEFAULT_PROFILING_TABLE_SET", "")
"""
Comma separated list of specific table names to include when running
profiling for the project database.
from env variable: `DEFAULT_PROFILING_TABLE_SET`
"""
DEFAULT_PROFILING_INCLUDE_MASK = os.getenv("DEFAULT_PROFILING_INCLUDE_MASK", "%")
"""
A SQL filter supported by the project database's `LIKE` operator for
table names to include.
from env variable: `DEFAULT_PROFILING_INCLUDE_MASK`
defaults to: `%`
"""
DEFAULT_PROFILING_EXCLUDE_MASK = os.getenv("DEFAULT_PROFILING_EXCLUDE_MASK", "tmp%")
"""
A SQL filter supported by the project database's `LIKE` operator for
table names to exclude.
from env variable: `DEFAULT_PROFILING_EXCLUDE_MASK`
defaults to: `tmp%`
"""
DEFAULT_PROFILING_ID_COLUMN_MASK = os.getenv("DEFAULT_PROFILING_ID_COLUMN_MASK", "%id")
"""
A SQL filter supported by the project database's `LIKE` operator
representing ID columns.
from env variable: `DEFAULT_PROFILING_ID_COLUMN_MASK`
defaults to: `%id`
"""
DEFAULT_PROFILING_SK_COLUMN_MASK = os.getenv("DEFAULT_PROFILING_SK_COLUMN_MASK", "%sk")
"""
A SQL filter supported by the project database's `LIKE` operator
representing surrogate key columns.
from env variable: `DEFAULT_PROFILING_SK_COLUMN_MASK`
defaults to: `%sk`
"""
DEFAULT_PROFILING_USE_SAMPLING: str = os.getenv("DEFAULT_PROFILING_USE_SAMPLING", "N")
"""
Toggle on to base profiling on a sample of records instead of the full
table. Accepts `Y` or `N`
from env variable: `DEFAULT_PROFILING_USE_SAMPLING`
defaults to: `N`
"""
OBSERVABILITY_API_URL: str = os.getenv("OBSERVABILITY_API_URL", "")
"""
API URL of your instance of Observability where to send events to for
the project.
You can configure this from the UI settings page.
from env variable: `OBSERVABILITY_API_URL`
"""
OBSERVABILITY_API_KEY: str = os.getenv("OBSERVABILITY_API_KEY", "")
"""
Authentication key with permissions to send events created in your
instance of Observability.
You can configure this from the UI settings page.
from env variable: `OBSERVABILITY_API_KEY`
"""
OBSERVABILITY_VERIFY_SSL: bool = os.getenv("TG_EXPORT_TO_OBSERVABILITY_VERIFY_SSL", "yes").lower() in ["yes", "true"]
"""
When False, exporting events to your instance of Observability will skip
SSL verification.
from env variable: `TG_EXPORT_TO_OBSERVABILITY_VERIFY_SSL`
defaults to: `True`
"""
OBSERVABILITY_EXPORT_LIMIT: int = int(os.getenv("TG_OBSERVABILITY_EXPORT_MAX_QTY", "5000"))
"""
When exporting to your instance of Observability, the maximum number of
events that will be sent to the events API on a single export.
from env variable: `TG_OBSERVABILITY_EXPORT_MAX_QTY`
defaults to: `5000`
"""
OBSERVABILITY_DEFAULT_COMPONENT_TYPE: str = os.getenv("OBSERVABILITY_DEFAULT_COMPONENT_TYPE", "dataset")
"""
When exporting to your instance of Observability, the type of event that
will be sent to the events API.
from env variable: `OBSERVABILITY_DEFAULT_COMPONENT_TYPE`
defaults to: `dataset`
"""
OBSERVABILITY_DEFAULT_COMPONENT_KEY: str = os.getenv("OBSERVABILITY_DEFAULT_COMPONENT_KEY", "default")
"""
When exporting to your instance of Observability, the key sent to the
events API to identify the components.
from env variable: `OBSERVABILITY_DEFAULT_COMPONENT_KEY`
defaults to: `default`
"""
CHECK_FOR_LATEST_VERSION: typing.Literal["pypi", "docker"] = typing.cast(
typing.Literal["pypi", "docker"],
os.getenv("TG_RELEASE_CHECK", "pypi").lower(),
)
"""
Specifies whether the latest version check should be based on PyPI or DockerHub.
"""
DOCKER_HUB_REPOSITORY: str = os.getenv(
"TESTGEN_DOCKER_HUB_REPO",
"datakitchen/dataops-testgen",
)
"""
URL to the docker hub repository containing the dataops testgen image.
Used to check for new releases when `CHECK_FOR_LATEST_VERSION` is set to
`docker`.
"""
VERSION: str = os.getenv("TESTGEN_VERSION", None)
"""
Current deployed version. The value is displayed in the UI menu.
"""
SUPPORT_EMAIL: str = os.getenv("TESTGEN_SUPPORT_EMAIL", "open-source-support@datakitchen.io")
"""
Email for contacting DataKitchen support.
"""
SSL_CERT_FILE: str = os.getenv("SSL_CERT_FILE", "")
SSL_KEY_FILE: str = os.getenv("SSL_KEY_FILE", "")
"""
File paths for SSL certificate and private key to support HTTPS.
Both files must be provided.
"""
MIXPANEL_URL: str = "https://api.mixpanel.com"
MIXPANEL_TIMEOUT: int = 3
MIXPANEL_TOKEN: str = "973680ddf8c2b512e6f6d1f2959149eb"
"""
Mixpanel configuration
"""
INSTANCE_ID: str | None = os.getenv("TG_INSTANCE_ID", None)
"""
Random ID that uniquely identifies the instance.
"""
ANALYTICS_ENABLED: bool = os.getenv("TG_ANALYTICS", "yes").lower() in ("true", "yes")
"""
Disables sending usage data when set to any value except "true" and "yes". Defaults to "yes"
"""
ANALYTICS_JOB_SOURCE: str = os.getenv("TG_JOB_SOURCE", "CLI")
"""
Identifies the job trigger for analytics purposes.
"""
JWT_HASHING_KEY_B64: str = os.getenv("TG_JWT_HASHING_KEY")
"""
Random key used to sign/verify the authentication token
"""
ISSUE_REPORT_SOURCE_DATA_LOOKUP_LIMIT: int = os.getenv("TG_ISSUE_REPORT_SOURCE_DATA_LOOKUP_LIMIT", 50)
"""
Limit the number of records used to generate the PDF with test results and hygiene issue reports.
"""
EMAIL_FROM_ADDRESS: str | None = os.getenv("TG_EMAIL_FROM_ADDRESS")
"""
Email: Sender address
"""
SMTP_ENDPOINT: str | None = os.getenv("TG_SMTP_ENDPOINT")
"""
Email: SMTP endpoint
"""
SMTP_PORT: int | None = int(os.getenv("TG_SMTP_PORT", 0)) or None
"""
Email: SMTP port
"""
SMTP_USERNAME: str | None = os.getenv("TG_SMTP_USERNAME")
"""
Email: SMTP username
"""
SMTP_PASSWORD: str | None = os.getenv("TG_SMTP_PASSWORD")
"""
Email: SMTP password
"""