"""Config file for lambda.""" import os from secrets_manager.lambda_ext import LambdaSecretsManager # AWS region configuration DEFAULT_AWS_REGION = 'us-east-1' AWS_REGION = os.environ.get('AWS_REGION', DEFAULT_AWS_REGION) AWS_ACCOUNT_ID = os.environ.get('AWS_ACCOUNT_ID', '437795906767') SNS_ARN_PREFIX = f'arn:aws:sns:{AWS_REGION}:{AWS_ACCOUNT_ID}' # Environment setup QA_ENVIRONMENT = 'qa' PROD_ENVIRONMENT = 'prod' DEV_ENVIRONMENT = 'dev' ENVIRONMENT = os.environ.get('Environment') LAMBDA_NAME = f'{ENVIRONMENT}-publish-message' DYNAMO_TABLE = f'{ENVIRONMENT}_notifications-buffer' # identifier for messages sender BUFFER_POLLER_ID = os.environ.get('BUFFER_POLLER_ID', 'buffer-poller-sender-id') # noqa:E501 GETSTREAM_ID = os.environ.get('GETSTREAM_ID', 'getstream-sender-id') APPLICATION_NAME = 'publish-message' secrets_manager_client = LambdaSecretsManager( environment=ENVIRONMENT, service_name=APPLICATION_NAME) try: SEGMENT_WRITE_KEY = secrets_manager_client.get_cred('SEGMENT_WRITE_KEY') except: # noqa SEGMENT_WRITE_KEY = '' # Localization I18N_FOLDER_NAME = 'src/i18n' I18N_DOMAIN = 'messages' DEFAULT_LANGUAGE = 'en' # Social media platforms SOCIAL_PLATFORM_MAPPING = { 'Deezer': 'Fans', 'Instagram': 'Followers', 'Facebook': 'Fans', 'YouTube': 'Subscribers', 'Spotify': 'Followers', 'Twitter': 'Followers', 'Soundcloud': 'Followers' } """ key => verb field in event aggregate => time in seconds to bunch events together message_func => function name to process events into notifications feed_type => subscription.feedType that controls subscription enabled """ EVENT_TYPES = { 'trending_tracks': { 'aggregate': 900, 'message_func': 'create_trending_track_message', 'feed_type': 'trending_tracks' }, 'playlist_placements': { 'aggregate': 3600, 'message_func': 'create_playlist_placement_message', 'feed_type': 'playlist_placements' }, 'social_spike_twitter': { 'aggregate': 0, 'message_func': 'create_social_spike_message', 'feed_type': 'social_spike' }, 'social_spike_instagram': { 'aggregate': 0, 'message_func': 'create_social_spike_message', 'feed_type': 'social_spike' }, 'social_spike_youtube': { 'aggregate': 0, 'message_func': 'create_social_spike_message', 'feed_type': 'social_spike' }, 'streams_updated': { 'aggregate': 0, 'message_func': 'create_streams_updated_message', 'feed_type': 'streams_updated' } } DSP_MAPPING = { 'spotify': 'Spotify', 'itunes/apple': 'Apple Music', 'amazon': 'Amazon Music' } STORE_MAPPING = { 286: 'Spotify streams', } ORCHARD_EMAIL_ADDRESS = 'notifications@theorchard.com' TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), 'src/templates') ORCHARD_BRAND = 'orchard' AWAL_BRAND = 'awal' SME_BRAND = 'sme'