blob: 0efb7e35cd422e1a3af0088f5524ec48240d647e [file] [log] [blame]
Michal Kobuse7589f72020-09-11 14:29:37 +02001import os
2
Ryan Zhang532052d2022-05-09 10:23:34 -07003from ..helpers import is_true, get_env_or_secret
Michal Kobus2e85ef82021-06-24 18:01:43 +02004
5
Michal Kobus819cf022018-11-29 16:39:22 +01006VERSION = 'development'
7
Mateusz Matuszkowiak2820c662018-11-21 12:07:25 +01008LOGGING = {
9 'version': 1,
10 'formatters': {'default': {
11 'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
12 }},
13 'handlers': {'wsgi': {
14 'class': 'logging.StreamHandler',
15 'stream': 'ext://flask.logging.wsgi_errors_stream',
16 'formatter': 'default'
17 }},
18 'loggers': {
Ksawery Dziekoński3861b932021-05-27 14:01:44 +020019 logger: {
20 'level': os.getenv('LOGGER_LEVEL', 'INFO').upper(),
Mateusz Matuszkowiak2820c662018-11-21 12:07:25 +010021 'handlers': ['wsgi']
Ksawery Dziekoński3861b932021-05-27 14:01:44 +020022 } for logger in ['sf_notifier.server', 'sf_notifier.salesforce.client']
Mateusz Matuszkowiak2820c662018-11-21 12:07:25 +010023 }
24}
25
26SIMPLE_SETTINGS = {
27 'OVERRIDE_BY_ENV': True,
28 'CONFIGURE_LOGGING': True,
29}
30
Michal Kobus2e85ef82021-06-24 18:01:43 +020031ADD_LINKS = is_true(os.environ.get('SF_NOTIFIER_ADD_LINKS'))
Michal Kobus28b37f92022-06-14 11:06:24 +020032CLUSTER_ID = os.environ.get('SF_NOTIFIER_CLUSTER_ID')
Michal Kobuse7589f72020-09-11 14:29:37 +020033
Michal Kobus2e85ef82021-06-24 18:01:43 +020034SF_CONFIG = {
35 # Salesforce login params
36 'AUTH_URL': os.environ.get('SFDC_AUTH_URL', 'null'),
Ryan Zhang532052d2022-05-09 10:23:34 -070037 'USERNAME': get_env_or_secret('SFDC_USERNAME', 'sfdc_username'),
38 'PASSWORD': get_env_or_secret('SFDC_PASSWORD', 'sfdc_password'),
Michal Kobus2e85ef82021-06-24 18:01:43 +020039 'ORGANIZATION_ID': os.environ.get('SFDC_ORGANIZATION_ID', 'null'),
Ryan Zhang532052d2022-05-09 10:23:34 -070040 'ENVIRONMENT_ID': get_env_or_secret('SFDC_ENVIRONMENT_ID', 'sfdc_environment_id'),
Michal Kobus2e85ef82021-06-24 18:01:43 +020041 'SANDBOX_ENABLED': is_true(os.environ.get(
42 'SFDC_SANDBOX_ENABLED', 'False')),
43 # sf-notifier specific params
44 'FEED_ENABLED': is_true(os.environ.get(
45 'SF_NOTIFIER_FEED_ENABLED', 'True')),
46 'HASH_FUNC': os.environ.get(
47 'SF_NOTIFIER_ALERT_ID_HASH_FUNC', 'sha256'),
48}