Skip to content

Commit

Permalink
fix: client s3 config
Browse files Browse the repository at this point in the history
  • Loading branch information
masb0ymas committed Dec 25, 2022
1 parent 12d78a1 commit d8a6fa1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/config/clientS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 69,9 @@ const initialAwsS3 = async (): Promise<
}

const getNumberExpires = AWS_S3_EXPIRED.replace(/[^0-9]/g, '')
const getMilliSecondExpires = ms(AWS_S3_EXPIRED)

// S3 Object Expired ( 7 days )
export const s3ObjectExpired = Number(getMilliSecondExpires) / 1000
export const s3ObjectExpired = ms(AWS_S3_EXPIRED) / 1000

// S3 Expires in 7 days
export const s3ExpiresDate = addDays(new Date(), Number(getNumberExpires))
Expand Down
30 changes: 18 additions & 12 deletions src/config/env.ts
Original file line number Diff line number Diff line change
@@ -1,19 1,19 @@
/* eslint-disable prettier/prettier */
import 'dotenv/config'

function validateBoolean(value: any): boolean {
const invalidValues = [
null,
undefined,
'',
false,
0,
'false',
'0',
'null',
'undefined',
]
const invalidValues = [
null,
undefined,
'',
false,
0,
'false',
'0',
'null',
'undefined',
]

function validateBoolean(value: any): boolean {
if (invalidValues.includes(value)) {
return false
}
Expand Down Expand Up @@ -106,3 106,9 @@ export const AWS_SECRET_KEY: any = process.env.AWS_SECRET_KEY ?? undefined
export const AWS_BUCKET_NAME = process.env.AWS_BUCKET_NAME ?? 'expresso'
export const AWS_REGION = process.env.AWS_REGION ?? 'ap-southeast-1'
export const AWS_S3_EXPIRED = process.env.AWS_S3_EXPIRED ?? '7d'

// google cloud platform
export const GCP_PROJECT_ID = process.env.GCP_PROJECT_ID ?? undefined
export const GCS_BUCKET_NAME = process.env.GCS_BUCKET_NAME ?? 'expresso'
export const GCS_REGION = process.env.GCS_REGION ?? 'asia-southeast2'
export const GCS_EXPIRED = process.env.GCS_EXPIRED ?? '7d'

0 comments on commit d8a6fa1

Please sign in to comment.