Read app base URL from env var (#165)

This commit is contained in:
Alexei Moisseev 2022-10-10 16:55:25 +03:00 committed by GitHub
parent c3a3597b7d
commit 3d5da90102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -2,3 +2,5 @@ NODE_ENV=development
TELEGRAM_T_API_ID=
TELEGRAM_T_API_HASH=
BASE_URL=https://web.telegram.org/z/

View File

@ -21,19 +21,19 @@
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://web.telegram.org/z/">
<meta property="og:url" content="<%= htmlWebpackPlugin.options.baseUrl %>">
<meta property="og:title" content="<%= htmlWebpackPlugin.options.appName %>">
<meta property="og:description" content="Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.">
<meta property="og:image" content="./<%= htmlWebpackPlugin.options.mainIcon %>.png">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://web.telegram.org/z/">
<meta property="twitter:url" content="<%= htmlWebpackPlugin.options.baseUrl %>">
<meta property="twitter:title" content="<%= htmlWebpackPlugin.options.appName %>">
<meta property="twitter:description" content="Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.">
<meta property="twitter:image" content="./<%= htmlWebpackPlugin.options.mainIcon %>.png">
<link rel="canonical" href="https://web.telegram.org/z/" />
<link rel="canonical" href="<%= htmlWebpackPlugin.options.baseUrl %>" />
<link rel="apple-touch-icon" sizes="180x180" href="./<%= htmlWebpackPlugin.options.appleIcon %>.png">
<link rel="icon" href="./favicon.svg" type="image/svg+xml">
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">

View File

@ -23,6 +23,8 @@ const {
dotenv.config();
const { BASE_URL = 'https://web.telegram.org/z/' } = process.env;
module.exports = (_env, { mode = 'production' }) => {
return {
mode,
@ -145,6 +147,7 @@ module.exports = (_env, { mode = 'production' }) => {
appleIcon: APP_ENV === 'production' ? 'apple-touch-icon' : 'apple-touch-icon-dev',
mainIcon: APP_ENV === 'production' ? 'icon-192x192' : 'icon-dev-192x192',
manifest: APP_ENV === 'production' ? 'site.webmanifest' : 'site_dev.webmanifest',
baseUrl: BASE_URL,
template: 'src/index.html',
}),
new MiniCssExtractPlugin({