File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,30 @@ import { fileURLToPath } from 'node:url';
4
4
import path from 'node:path' ;
5
5
import dotenv from 'dotenv' ;
6
6
import proxy from './server/app.js' ;
7
+ import { copyFileSync } from 'node:fs' ;
7
8
8
9
dotenv . config ( ) ;
9
10
11
+ const isDev = process . argv . includes ( '--dev' ) ;
12
+
10
13
const __filename = fileURLToPath ( import . meta. url ) ;
11
14
const __dirname = path . dirname ( __filename ) ;
15
+ const frontendConfigLocation = isDev
16
+ ? 'public/frontend-config.json'
17
+ : 'dist/client/frontend-config.json' ;
18
+
19
+ if (
20
+ process . env . FRONTEND_CONFIG_PATH !== undefined &&
21
+ process . env . FRONTEND_CONFIG_PATH . length > 0
22
+ ) {
23
+ console . log (
24
+ 'FRONTEND_CONFIG_PATH is specified. Will copy the frontend-config from there.' ,
25
+ ) ;
26
+ console . log (
27
+ ` Copying ${ process . env . FRONTEND_CONFIG_PATH } to ${ frontendConfigLocation } ` ,
28
+ ) ;
29
+ copyFileSync ( process . env . FRONTEND_CONFIG_PATH , frontendConfigLocation ) ;
30
+ }
12
31
13
32
const fastify = Fastify ( {
14
33
logger : true ,
@@ -20,7 +39,7 @@ fastify.register(proxy, {
20
39
21
40
await fastify . register ( FastifyVite , {
22
41
root : __dirname ,
23
- dev : process . argv . includes ( '--dev' ) ,
42
+ dev : isDev ,
24
43
spa : true ,
25
44
} ) ;
26
45
You can’t perform that action at this time.
0 commit comments