Skip to content

Commit

Permalink
Merge pull request #4 from 524H0003:Quick-patch
Browse files Browse the repository at this point in the history
update app.module.ts, config.module.ts and test.module.ts
  • Loading branch information
Nguyễn Việt Anh authored Oct 11, 2024
2 parents f7c1287 + 73bc73e commit d0278dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { AuthModule } from 'auth/auth.module';
}),
// Sub modules
AuthModule,
loadEnv('deploy'),
loadEnv,
SqlModule('deploy'),
],
})
Expand Down
12 changes: 3 additions & 9 deletions src/app/module/config.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ConfigModule } from '@nestjs/config';
import Joi from 'joi';
import 'app/utils/utils';

export const loadEnv = (type: 'deploy' | 'test') =>
export const loadEnv =
// Load .env
ConfigModule.forRoot({
isGlobal: true,
Expand All @@ -15,16 +15,10 @@ export const loadEnv = (type: 'deploy' | 'test') =>
POSTGRES_PASS: Joi.string().default('postgres'),
POSTGRES_SSL: Joi.string().default(false),
// Access token
ACCESS_SECRET:
type === 'deploy'
? Joi.string().required()
: Joi.string().default((10).string),
ACCESS_SECRET: Joi.string().default((10).string),
ACCESS_EXPIRE: Joi.string().default('6m'),
// Refresh token
REFRESH_SECRET:
type === 'deploy'
? Joi.string().required()
: Joi.string().default((10).string),
REFRESH_SECRET: Joi.string().default((10).string),
REFRESH_EXPIRE: Joi.string().default('66d'),
REFRESH_USE: Joi.number().default(6),
// Server config
Expand Down
2 changes: 1 addition & 1 deletion src/app/module/test.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SignService } from 'auth/auth.service';
playground: false,
}),
JwtModule.register({ global: true }),
loadEnv('test'),
loadEnv,
SqlModule('test'),
],
providers: [SignService],
Expand Down

0 comments on commit d0278dd

Please sign in to comment.