Make feed item update optional
- SF_NOTIFIER_FEED_ENABLED env var
True by default for backward compatibility
- cleanup config setting and validation
- redirect uwsgi request logs to file to limit noise
- cleanup logging path setting
Change-Id: I1e40a83ce5aadb58f9908c586bc0b92e02a902a9
Related-PROD: PRODX-15636
diff --git a/sf_notifier/settings/production.py b/sf_notifier/settings/production.py
index e0450c8..6251daf 100644
--- a/sf_notifier/settings/production.py
+++ b/sf_notifier/settings/production.py
@@ -1,5 +1,8 @@
import os
+from ..helpers import is_true
+
+
VERSION = 'production'
LOGGING = {
@@ -16,7 +19,8 @@
'file': {
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'default',
- 'filename': '/var/log/sf-notifier/sfnotifier.log',
+ 'filename': os.getenv('LOGPATH',
+ '/var/log/sf-notifier/sfnotifier.log'),
'mode': 'a',
'maxBytes': 10485760,
'backupCount': 5
@@ -35,7 +39,20 @@
'CONFIGURE_LOGGING': True,
}
-ADD_LINKS = os.environ.get('SF_NOTIFIER_ADD_LINKS',
- False) in ['true', 'True', True]
+ADD_LINKS = is_true(os.environ.get('SF_NOTIFIER_ADD_LINKS'))
-SF_CONFIG = {}
+SF_CONFIG = {
+ # Salesforce login params
+ 'AUTH_URL': os.environ.get('SFDC_AUTH_URL', 'null'),
+ 'USERNAME': os.environ.get('SFDC_USERNAME', 'null'),
+ 'PASSWORD': os.environ.get('SFDC_PASSWORD', 'null'),
+ 'ORGANIZATION_ID': os.environ.get('SFDC_ORGANIZATION_ID', 'null'),
+ 'ENVIRONMENT_ID': os.environ.get('SFDC_ENVIRONMENT_ID', 'null'),
+ 'SANDBOX_ENABLED': is_true(os.environ.get(
+ 'SFDC_SANDBOX_ENABLED', 'False')),
+ # sf-notifier specific params
+ 'FEED_ENABLED': is_true(os.environ.get(
+ 'SF_NOTIFIER_FEED_ENABLED', 'True')),
+ 'HASH_FUNC': os.environ.get(
+ 'SF_NOTIFIER_ALERT_ID_HASH_FUNC', 'sha256'),
+}