mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 05:46:28 +02:00
Add allowing push notifications
This commit is contained in:
@@ -125,4 +125,28 @@ const config = (isWeb = false): Configuration => ({
|
||||
},
|
||||
})
|
||||
|
||||
export function getClientEnvironment(allowedKeys: string[]): any {
|
||||
const raw = Object.keys(process.env)
|
||||
// Custom regex to allow only a certain category of variables available to the application
|
||||
.filter((key) => allowedKeys.indexOf(key) >= 0)
|
||||
.reduce(
|
||||
(env: any, key: string) => {
|
||||
env[key] = process.env[key]
|
||||
return env
|
||||
},
|
||||
{
|
||||
NODE_ENV: process.env.NODE_ENV || "development",
|
||||
}
|
||||
)
|
||||
// Stringify all values so we can feed into Webpack DefinePlugin
|
||||
const stringified = {
|
||||
"process.env": Object.keys(raw).reduce((env: any, key: string) => {
|
||||
env[key] = JSON.stringify(raw[key])
|
||||
return env
|
||||
}, {}),
|
||||
}
|
||||
|
||||
return stringified
|
||||
}
|
||||
|
||||
export default config
|
||||
|
@@ -7,7 +7,7 @@ import CompressionPlugin from "compression-webpack-plugin"
|
||||
import ImageMinimizerPlugin from "image-minimizer-webpack-plugin"
|
||||
import merge from "webpack-merge"
|
||||
|
||||
import baseConfig, { isDev } from "./base.config"
|
||||
import baseConfig, { isDev, getClientEnvironment } from "./base.config"
|
||||
|
||||
const getPlugins = () => {
|
||||
let plugins = [
|
||||
@@ -16,6 +16,7 @@ const getPlugins = () => {
|
||||
filename: isDev ? "[name].css" : "[name].[contenthash].css",
|
||||
chunkFilename: isDev ? "[id].css" : "[id].[contenthash].css",
|
||||
}),
|
||||
new webpack.DefinePlugin(getClientEnvironment(["FORCE_ORANGE_PUBLIC_VAPID_KEY"])),
|
||||
]
|
||||
|
||||
if (isDev)
|
||||
|
Reference in New Issue
Block a user