@@ -16,18 +16,18 @@ const processDirs = (dirPath) => {
16
16
processDirs ( itemAbsPath ) ;
17
17
} else {
18
18
if ( allowedExtensions . includes ( path . extname ( itemAbsPath ) ) ) {
19
- fileEnvsubst ( itemAbsPath ) ;
19
+ fileEnvSubstitution ( itemAbsPath ) ;
20
20
}
21
21
}
22
22
} ) ;
23
23
} ;
24
24
25
- const fileEnvsubst = ( itemAbsPath ) => {
25
+ const fileEnvSubstitution = ( itemAbsPath ) => {
26
26
let hydratedTemplate = fs . readFileSync ( itemAbsPath , 'utf8' ) ;
27
27
28
28
Object . entries ( process . env ) . forEach ( ( [ name , value ] ) => {
29
29
if ( typeof value !== 'string' ) {
30
- // stringifying strings adds surrounding dquotes ; we don't want that
30
+ // stringify strings adds surrounding quotes ; we don't want that
31
31
value = JSON . stringify ( value )
32
32
}
33
33
@@ -41,17 +41,21 @@ const fileEnvsubst = (itemAbsPath) => {
41
41
fs . writeFileSync ( itemAbsPath , hydratedTemplate ) ;
42
42
} ;
43
43
44
- const generateClientSecrets = ( clients ) => {
44
+ const generateClientUuidAndSecrets = ( clients ) => {
45
45
for ( let client of clients ) {
46
46
47
47
const key = `${ client . toUpperCase ( ) } _CLIENT_SECRET` ;
48
48
if ( ! ( key in process . env ) ) {
49
49
process . env [ key ] = randomUUID ( ) ;
50
50
}
51
-
51
+
52
+ const clientUuidKey = `${ client . toUpperCase ( ) } _CLIENT_UUID` ;
53
+ if ( ! ( clientUuidKey in process . env ) ) {
54
+ process . env [ clientUuidKey ] = randomUUID ( ) ;
55
+ }
52
56
}
53
57
}
54
58
55
- generateClientSecrets ( clients )
59
+ generateClientUuidAndSecrets ( clients ) ;
56
60
57
- processDirs ( process . env . FILE_PATH ) ;
61
+ processDirs ( process . env . FILE_PATH ) ;
0 commit comments