diff --git a/.env b/.env new file mode 100644 index 000000000..548ee17aa --- /dev/null +++ b/.env @@ -0,0 +1 @@ +SENTRY_DSN=https://e47a6d214ae4478b81136c29612003a7@sentry.io/1911455 diff --git a/package.json b/package.json index da82654cf..35703926e 100755 --- a/package.json +++ b/package.json @@ -6,9 +6,6 @@ "website": "www.stremio.com", "private": true, "license": "GPLv3", - "sentry": { - "dsn": "https://e47a6d214ae4478b81136c29612003a7@sentry.io/1911455" - }, "scripts": { "start": "webpack-dev-server --mode development", "build": "webpack --mode production", @@ -54,6 +51,7 @@ "css-loader": "3.4.0", "cssnano": "4.1.10", "cssnano-preset-advanced": "4.0.7", + "dotenv": "8.2.0", "eslint": "6.7.2", "eslint-plugin-react": "7.17.0", "html-webpack-plugin": "3.2.0", @@ -69,4 +67,4 @@ "webpack-cli": "3.3.10", "webpack-dev-server": "3.10.0" } -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js index 36220dbaf..66c2ab1f9 100755 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,8 @@ const React = require('react'); const ReactDOM = require('react-dom'); const Sentry = require('@sentry/browser'); -const package = require('../package.json'); const App = require('./App'); -Sentry.init(package.sentry); +Sentry.init({ dsn: process.env.SENTRY_DSN }); ReactDOM.render(, document.getElementById('app')); diff --git a/webpack.config.js b/webpack.config.js index a9c28c840..f780a2b31 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,6 @@ const path = require('path'); const webpack = require('webpack'); +const dotenv = require('dotenv').config(); const HtmlWebPackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); @@ -128,6 +129,7 @@ module.exports = { ] }, plugins: [ + new webpack.EnvironmentPlugin(dotenv.parsed), new webpack.ProgressPlugin(), new CopyWebpackPlugin([ { from: 'node_modules/stremio-core-web/static', to: '' }, diff --git a/yarn.lock b/yarn.lock index bbf906594..73917d842 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4472,16 +4472,16 @@ dotenv-webpack@^1.7.0: dependencies: dotenv-defaults "^1.0.2" +dotenv@8.2.0, dotenv@^8.0.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" + integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== + dotenv@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w== -dotenv@^8.0.0: - version "8.2.0" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" - integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== - duplexer@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"