apps/web: fix pass USE_DEV_COLORS variable to client

This commit is contained in:
vchikalkin 2023-12-23 15:03:09 +03:00
parent e033886097
commit 126643982b
6 changed files with 10 additions and 9 deletions

2
.env
View File

@ -1,3 +1,3 @@
USE_DEV_COLORS=
NEXT_PUBLIC_USE_DEV_COLORS=
URL_IUS_DIRECT=

View File

@ -6,5 +6,7 @@ import logoDev from 'public/assets/images/logo-primary-dev.svg';
const env = getEnv();
export function Logo() {
return <Image priority alt="logo" src={env.USE_DEV_COLORS ? logoDev : logo} height="24" />;
return (
<Image priority alt="logo" src={env.NEXT_PUBLIC_USE_DEV_COLORS ? logoDev : logo} height="24" />
);
}

View File

@ -2,7 +2,7 @@ const { z } = require('zod');
const envSchema = z.object({
URL_IUS_DIRECT: z.string(),
USE_DEV_COLORS: z.string().optional(),
NEXT_PUBLIC_USE_DEV_COLORS: z.string().optional(),
});
module.exports = envSchema;

View File

@ -13,4 +13,4 @@ export const COLORS_DEV = {
COLOR_TERTIARTY: '#FF9112',
};
const env = getEnv();
export const COLORS = env.USE_DEV_COLORS ? COLORS_DEV : COLORS_PROD;
export const COLORS = env.NEXT_PUBLIC_USE_DEV_COLORS ? COLORS_DEV : COLORS_PROD;

View File

@ -6,7 +6,7 @@ const urls = require('./constants/urls');
const env = envSchema.parse(process.env);
const favicons = fs.readdirSync('./public/favicon/prod');
const faviconSubPath = env.USE_DEV_COLORS ? '/favicon/dev' : '/favicon/prod';
const faviconSubPath = env.NEXT_PUBLIC_USE_DEV_COLORS ? '/favicon/dev' : '/favicon/prod';
function buildFaviconRewrite(source) {
return {
destination: String.prototype.concat(faviconSubPath, source),
@ -34,7 +34,6 @@ const nextConfig = {
...favicons.map((fileName) => buildFaviconRewrite(`/${fileName}`)),
];
},
env,
};
module.exports = nextConfig;

View File

@ -1,9 +1,9 @@
version: '3.3'
services:
external_client:
environment:
- URL_IUS_DIRECT=${URL_IUS_DIRECT}
- USE_DEV_COLORS=${USE_DEV_COLORS}
# environment:
# - URL_IUS_DIRECT=${URL_IUS_DIRECT}
# - NEXT_PUBLIC_USE_DEV_COLORS=${NEXT_PUBLIC_USE_DEV_COLORS}
build:
context: .
dockerfile: ./apps/web/Dockerfile