2017-11-22 14:51:32 -07:00
|
|
|
/**
|
|
|
|
* Constant Replacer
|
|
|
|
*/
|
|
|
|
|
|
|
|
import * as webpack from 'webpack';
|
|
|
|
|
|
|
|
import version from '../../src/version';
|
|
|
|
const constants = require('../../src/const.json');
|
|
|
|
import config from '../../src/conf';
|
2018-02-15 03:59:07 -07:00
|
|
|
import { licenseHtml } from '../../src/common/build/license';
|
2017-11-22 14:51:32 -07:00
|
|
|
|
|
|
|
export default lang => {
|
|
|
|
const consts = {
|
|
|
|
_RECAPTCHA_SITEKEY_: config.recaptcha.site_key,
|
|
|
|
_SW_PUBLICKEY_: config.sw ? config.sw.public_key : null,
|
|
|
|
_THEME_COLOR_: constants.themeColor,
|
2017-12-16 12:31:24 -07:00
|
|
|
_COPYRIGHT_: constants.copyright,
|
2017-11-22 14:51:32 -07:00
|
|
|
_VERSION_: version,
|
|
|
|
_STATUS_URL_: config.status_url,
|
|
|
|
_STATS_URL_: config.stats_url,
|
2017-12-16 09:41:22 -07:00
|
|
|
_DOCS_URL_: config.docs_url,
|
2017-11-22 14:51:32 -07:00
|
|
|
_API_URL_: config.api_url,
|
|
|
|
_DEV_URL_: config.dev_url,
|
|
|
|
_CH_URL_: config.ch_url,
|
|
|
|
_LANG_: lang,
|
|
|
|
_HOST_: config.host,
|
|
|
|
_URL_: config.url,
|
2018-02-15 03:59:07 -07:00
|
|
|
_LICENSE_: licenseHtml
|
2017-11-22 14:51:32 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
const _consts = {};
|
|
|
|
|
|
|
|
Object.keys(consts).forEach(key => {
|
|
|
|
_consts[key] = JSON.stringify(consts[key]);
|
|
|
|
});
|
|
|
|
|
2018-02-15 03:59:07 -07:00
|
|
|
return new webpack.DefinePlugin(_consts);
|
2017-11-22 14:51:32 -07:00
|
|
|
};
|