Skip to content

Commit

Permalink
Merge pull request #6 from OCHA-DAP/dev
Browse files Browse the repository at this point in the history
add hdx url env var
  • Loading branch information
danmihaila authored Oct 24, 2024
2 parents 72c9c62 + 0113ddd commit cc849ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Config:
HDX_ENABLED_DATASETS_CSV: str
NOVU_API_KEY: str
NOVU_API_URL: str
HDX_URL: str


CONFIG = None
Expand All @@ -24,6 +25,7 @@ def get_config() -> Config:
'https://docs.google.com/spreadsheets/d/e/2PACX-1vSsBSUTM3f9olyhVFDcAh-tXV63wlOtvsXukQIHTLiLCfbGJC8osDDaEqzoUVs2B0kgYMrkyVkihvVm/pub?gid=0&single=true&output=csv'),
NOVU_API_KEY=os.getenv('NOVU_API_KEY'),
NOVU_API_URL=os.getenv('NOVU_API_URL', 'https://api.novu.co/v1/events/trigger'),
HDX_URL= os.getenv('HDX_URL', 'https://stage.data-humdata-org.ahconu.org'),
)

return CONFIG
5 changes: 4 additions & 1 deletion processing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

from processing.helpers import get_change_summary
from processing.novu import push_notification_to_novu
from config.config import get_config

logger = logging.getLogger(__name__)

config = get_config()

def process(dataset_id_list: Set[str], event: Dict):
if dataset_id_list:
Expand All @@ -16,7 +18,8 @@ def process(dataset_id_list: Set[str], event: Dict):
data_dict = {
'event': event,
'change_summary': change_summary,
'unsubscribe_token_key': f'unsubscribe_token_{_dataset_id}'
'unsubscribe_token_key': f'unsubscribe_token_{_dataset_id}',
'hdx_url': config.HDX_URL
}
push_notification_to_novu(data_dict)

Expand Down

0 comments on commit cc849ff

Please sign in to comment.