File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -12,15 +12,18 @@ const getUniqueCodev2 = (length = 32) => {
12
12
return result
13
13
}
14
14
15
- function main ( ) {
15
+ function accessTokenJWT ( ) {
16
16
const pathRes = path . resolve ( '.env' )
17
17
const contentEnv = fs . readFileSync ( pathRes , { encoding : 'utf-8' } )
18
18
const jwtSecret = getUniqueCodev2 ( )
19
- const strJWT = `JWT_SECRET =${ jwtSecret } `
19
+ const strJWT = `JWT_SECRET_ACCESS_TOKEN =${ jwtSecret } `
20
20
21
- if ( contentEnv . includes ( 'JWT_SECRET =' ) ) {
21
+ if ( contentEnv . includes ( 'JWT_SECRET_ACCESS_TOKEN =' ) ) {
22
22
// Replace JWT SECRET jika sudah ada
23
- const replaceContent = contentEnv . replace ( / J W T _ S E C R E T = ( .* ) ? / , strJWT )
23
+ const replaceContent = contentEnv . replace (
24
+ / J W T _ S E C R E T _ A C C E S S _ T O K E N = ( .* ) ? / ,
25
+ strJWT
26
+ )
24
27
fs . writeFileSync ( `${ pathRes } ` , replaceContent )
25
28
console . log ( 'Refresh JWT SECRET Success' )
26
29
} else {
@@ -53,5 +56,5 @@ function refreshTokenJWT() {
53
56
}
54
57
}
55
58
56
- main ( )
59
+ accessTokenJWT ( )
57
60
refreshTokenJWT ( )
You can’t perform that action at this time.
0 commit comments