diff --git a/web/app/common/constants.js b/web/app/common/constants.js index 06705ef5..c8a65b56 100644 --- a/web/app/common/constants.js +++ b/web/app/common/constants.js @@ -1,4 +1,4 @@ -const BASE_URL = 'https://demo.remark42.com'; +const BASE_URL = process.env.BASE_URL; const API_BASE = '/api/v1'; const NODE_ID = 'remark42'; const COUNTER_NODE_CLASSNAME = 'remark42__counter'; diff --git a/web/counter.ejs b/web/counter.ejs index 106332c5..a92aba7d 100644 --- a/web/counter.ejs +++ b/web/counter.ejs @@ -44,7 +44,7 @@ (function() { var d = document, s = d.createElement('script'); - s.src = 'https://demo.remark42.com/web/counter.js'; + s.src = '<%= htmlWebpackPlugin.options.baseUrl %>/web/counter.js'; s.type = 'text/javascript'; (d.head || d.body).appendChild(s); })(); diff --git a/web/index.ejs b/web/index.ejs index 7fdf45ef..da76f8c4 100644 --- a/web/index.ejs +++ b/web/index.ejs @@ -30,7 +30,7 @@ (function() { var d = document, s = d.createElement('script'); - s.src = 'https://demo.remark42.com/web/embed.js'; + s.src = '<%= htmlWebpackPlugin.options.baseUrl %>/web/embed.js'; s.type = 'text/javascript'; (d.head || d.body).appendChild(s); })(); diff --git a/web/last-comments.ejs b/web/last-comments.ejs index d052a3de..d7722969 100644 --- a/web/last-comments.ejs +++ b/web/last-comments.ejs @@ -29,7 +29,7 @@ (function() { var d = document, s = d.createElement('script'); - s.src = 'https://demo.remark42.com/web/last-comments.js'; + s.src = '<%= htmlWebpackPlugin.options.baseUrl %>/web/last-comments.js'; s.type = 'text/javascript'; (d.head || d.body).appendChild(s); })(); diff --git a/web/webpack.config.js b/web/webpack.config.js index 48857e75..48c9b256 100644 --- a/web/webpack.config.js +++ b/web/webpack.config.js @@ -12,6 +12,8 @@ const Define = webpack.DefinePlugin; const { NODE_ID } = require('./app/common/constants'); const publicFolder = path.resolve(__dirname, 'public'); const env = process.env.NODE_ENV || 'dev'; +// const url = process.env.REMARK_URL || 'https://demo.remark42.com'; +const url = process.env.REMARK_URL; const commonStyleLoaders = [ 'css-loader', @@ -99,23 +101,27 @@ module.exports = { }), new Define({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), + 'process.env.BASE_URL': JSON.stringify(url), }), // TODO: we should add it only on demo serv new Html({ template: path.resolve(__dirname, 'index.ejs'), inject: false, + baseUrl: url, }), // TODO: we should add it only on demo serv new Html({ template: path.resolve(__dirname, 'counter.ejs'), filename: 'counter.html', inject: false, + baseUrl: url, }), // TODO: we should add it only on demo serv new Html({ template: path.resolve(__dirname, 'last-comments.ejs'), filename: 'last-comments.html', inject: false, + baseUrl: url, }), ...(env === 'production' ? [] : [new Html({ template: path.resolve(__dirname, 'dev.ejs'),