mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 15:05:35 +00:00
add env var SITE_NAME + npm update + add env checker
This commit is contained in:
33
config.ts
Normal file
33
config.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
// const NEXT_PUBLIC_PREFIX = 'NEXT_PUBLIC_';
|
||||
|
||||
// const getEnvironmentVariable = (environmentVariable: string = ''): string => {
|
||||
// if (!environmentVariable.startsWith(NEXT_PUBLIC_PREFIX)) {
|
||||
// throw new Error(
|
||||
// `Env var must start with "${NEXT_PUBLIC_PREFIX}": ${environmentVariable}`
|
||||
// );
|
||||
// }
|
||||
|
||||
// const envVarObject = Object
|
||||
// .entries(process.env)
|
||||
// .map(([key, value]) => ({ name: key, value }))
|
||||
// .find((env) => {
|
||||
// console.log(env.name === environmentVariable);
|
||||
// return env.name === environmentVariable;
|
||||
// });
|
||||
|
||||
// console.log('envVarObject', envVarObject, process.env.NEXT_PUBLIC_SITE_NAME)
|
||||
|
||||
// if (!envVarObject) {
|
||||
// throw new Error(
|
||||
// `Couldn't find environment variable: ${environmentVariable}`
|
||||
// );
|
||||
// } else {
|
||||
// return envVarObject.value;
|
||||
// }
|
||||
// };
|
||||
|
||||
export const config = {
|
||||
siteName: process.env.NEXT_PUBLIC_SITE_NAME // getEnvironmentVariable(NEXT_PUBLIC_PREFIX + 'SITE_NAME'),
|
||||
};
|
||||
|
||||
console.log('config', config)
|
||||
Reference in New Issue
Block a user