Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[develop] Release 4.30.2 #114

Merged
merged 4 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "FormSG",
"description": "Form Manager for Government",
"version": "4.30.1",
"version": "4.30.2",
"homepage": "https://form.gov.sg",
"authors": [
"FormSG <[email protected]>"
Expand Down
5 changes: 3 additions & 2 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,12 @@ const awsConfig: AwsConfig = (function () {
// Else, the environment variables to instantiate S3 are used.
const awsEndpoint = isDev
? defaults.aws.endpoint
: `https://s3.${region}.amazonaws.com/`
: `https://s3.${region}.amazonaws.com` // NOTE NO TRAILING / AT THE END OF THIS URL!

const logoBucketUrl = `${awsEndpoint}/${logoS3Bucket}`
const imageBucketUrl = `${awsEndpoint}/${imageS3Bucket}`
const attachmentBucketUrl = `${awsEndpoint}/${attachmentS3Bucket}`
// NOTE THE TRAILING / AT THE END OF THIS URL! This is only for attachments!
const attachmentBucketUrl = `${awsEndpoint}/${attachmentS3Bucket}/`

const s3 = new aws.S3({
region,
Expand Down
8 changes: 5 additions & 3 deletions src/config/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import { v4 as uuidv4 } from 'uuid'
import { format, LoggerOptions, loggers, transports } from 'winston'
import WinstonCloudWatch from 'winston-cloudwatch'

import { aws, customCloudWatchGroup } from './config'
import defaults from './defaults'

// Cannot use config's isDev due to logger being instantiated first, and
// Cannot use config due to logger being instantiated first, and
// having circular dependencies.
const isDev = process.env.NODE_ENV === 'development'
const customCloudWatchGroup = process.env.CUSTOM_CLOUDWATCH_LOG_GROUP
const awsRegion = process.env.AWS_REGION || defaults.aws.region

// Config to make winston logging like console logging, allowing multiple
// arguments.
Expand Down Expand Up @@ -121,7 +123,7 @@ export const createCloudWatchLogger = (label: string) => {
// not share sequence tokens. Hence generate a unique ID for each instance
// of the logger.
logStreamName: uuidv4(),
awsRegion: aws.region,
awsRegion,
jsonMessage: true,
}),
]
Expand Down