2017-09-04 02:20:56 +00:00
|
|
|
import { applyMiddleware, compose } from 'redux';
|
2017-09-16 15:09:23 +00:00
|
|
|
import Raven from 'raven-js';
|
|
|
|
import createRavenMiddleware from 'raven-for-redux';
|
2017-09-04 02:20:56 +00:00
|
|
|
import thunk from 'redux-thunk';
|
|
|
|
import { routerMiddleware } from 'react-router-redux';
|
|
|
|
import persistState from './persistState';
|
|
|
|
|
|
|
|
export default function(history) {
|
|
|
|
const {
|
|
|
|
analytics,
|
|
|
|
branch,
|
|
|
|
version,
|
|
|
|
release,
|
|
|
|
isProduction
|
|
|
|
} = window.Sonarr;
|
|
|
|
|
2017-09-16 15:09:23 +00:00
|
|
|
const dsn = isProduction ? 'https://c3a5b33e08de4e18b7d0505e942dbc95@sentry.io/216290' :
|
|
|
|
'https://c3a5b33e08de4e18b7d0505e942dbc95@sentry.io/216290';
|
|
|
|
|
|
|
|
Raven.config(dsn).install();
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
const middlewares = [];
|
|
|
|
|
|
|
|
if (analytics) {
|
2017-09-16 15:09:23 +00:00
|
|
|
middlewares.push(createRavenMiddleware(Raven, {
|
2017-09-04 02:20:56 +00:00
|
|
|
environment: isProduction ? 'production' : 'development',
|
|
|
|
release,
|
|
|
|
tags: {
|
|
|
|
branch,
|
|
|
|
version
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
middlewares.push(routerMiddleware(history));
|
|
|
|
middlewares.push(thunk);
|
|
|
|
|
|
|
|
return compose(
|
|
|
|
applyMiddleware(...middlewares),
|
|
|
|
persistState
|
|
|
|
);
|
|
|
|
}
|