export function handler()

in src/index.js [15:39]


export function handler (events, context, callback) {
	const lambda = new AWS.Lambda();

	// The environment is hard-coded, as we don't require these alerts in CODE.
	ssm.getParameter({ Name: '/front-press-monitor/PROD/config' }).promise().then(({ Parameter: { Value: stringConfig }}) => {
		const jsonConfig = JSON.parse(stringConfig);

		const cmsfronts = new Client({
			bucket: jsonConfig.buckets.cmsfronts.name,
			env: 'PROD',
			configKey: jsonConfig.buckets.config
		});
		const frontend = new Client({
			bucket: jsonConfig.buckets.frontend.name,
			env: 'PROD',
			pressedTable: jsonConfig.facia.PROD.dynamo
		});

		return { cmsfronts, frontend, jsonConfig };
	}).then(({ cmsfronts, frontend, jsonConfig }) => {
		handleEvents({cmsfronts, frontend, lambda, jsonConfig})
			.then(() => callback())
			.catch(callback);
	});
}