blob: 054d4332e352c82eefcec439f5215a0cbeba04da [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 = 'production'
7
Michal Kobus17726ae2018-11-27 12:59:55 +01008LOGGING = {
9 'version': 1,
10 'formatters': {'default': {
11 'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
12 }},
13 'handlers': {
14 'wsgi': {
15 'class': 'logging.StreamHandler',
16 'stream': 'ext://flask.logging.wsgi_errors_stream',
17 'formatter': 'default'
18 },
19 'file': {
20 'class': 'logging.handlers.RotatingFileHandler',
21 'formatter': 'default',
Michal Kobus2e85ef82021-06-24 18:01:43 +020022 'filename': os.getenv('LOGPATH',
23 '/var/log/sf-notifier/sfnotifier.log'),
Michal Kobus17726ae2018-11-27 12:59:55 +010024 'mode': 'a',
25 'maxBytes': 10485760,
26 'backupCount': 5
27 }
28 },
29 'loggers': {
Ksawery Dziekoński3861b932021-05-27 14:01:44 +020030 logger: {
31 'level': os.getenv('LOGGER_LEVEL', 'INFO').upper(),
Michal Kobus17726ae2018-11-27 12:59:55 +010032 'handlers': ['file', 'wsgi']
Ksawery Dziekoński3861b932021-05-27 14:01:44 +020033 } for logger in ['sf_notifier.server', 'sf_notifier.salesforce.client']
Michal Kobus17726ae2018-11-27 12:59:55 +010034 }
35}
36
37SIMPLE_SETTINGS = {
38 'OVERRIDE_BY_ENV': True,
39 'CONFIGURE_LOGGING': True,
40}
41
Michal Kobus2e85ef82021-06-24 18:01:43 +020042ADD_LINKS = is_true(os.environ.get('SF_NOTIFIER_ADD_LINKS'))
Michal Kobus28b37f92022-06-14 11:06:24 +020043CLUSTER_ID = os.environ.get('SF_NOTIFIER_CLUSTER_ID')
Michal Kobuse7589f72020-09-11 14:29:37 +020044
Michal Kobus2e85ef82021-06-24 18:01:43 +020045SF_CONFIG = {
46 # Salesforce login params
47 'AUTH_URL': os.environ.get('SFDC_AUTH_URL', 'null'),
Ryan Zhang532052d2022-05-09 10:23:34 -070048 'USERNAME': get_env_or_secret('SFDC_USERNAME', 'sfdc_username'),
49 'PASSWORD': get_env_or_secret('SFDC_PASSWORD', 'sfdc_password'),
Michal Kobus2e85ef82021-06-24 18:01:43 +020050 'ORGANIZATION_ID': os.environ.get('SFDC_ORGANIZATION_ID', 'null'),
Ryan Zhang532052d2022-05-09 10:23:34 -070051 'ENVIRONMENT_ID': get_env_or_secret('SFDC_ENVIRONMENT_ID', 'sfdc_environment_id'),
Michal Kobus2e85ef82021-06-24 18:01:43 +020052 'SANDBOX_ENABLED': is_true(os.environ.get(
53 'SFDC_SANDBOX_ENABLED', 'False')),
54 # sf-notifier specific params
55 'FEED_ENABLED': is_true(os.environ.get(
56 'SF_NOTIFIER_FEED_ENABLED', 'True')),
57 'HASH_FUNC': os.environ.get(
58 'SF_NOTIFIER_ALERT_ID_HASH_FUNC', 'sha256'),
59}