Skip to content

Commit

Permalink
Adds option to enable SVG support (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofhouse authored Apr 4, 2022
1 parent 54409d7 commit 942e1c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
16 changes: 9 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ module "image_optimizer" {
publish = true

environment_variables = {
NODE_ENV = "production"
TF_NEXTIMAGE_BASE_ORIGIN = var.next_image_base_origin
TF_NEXTIMAGE_DOMAINS = jsonencode(var.next_image_domains)
TF_NEXTIMAGE_DEVICE_SIZES = var.next_image_device_sizes != null ? jsonencode(var.next_image_device_sizes) : null
TF_NEXTIMAGE_FORMATS = jsonencode(var.next_image_formats)
TF_NEXTIMAGE_IMAGE_SIZES = var.next_image_image_sizes != null ? jsonencode(var.next_image_image_sizes) : null
TF_NEXTIMAGE_SOURCE_BUCKET = var.source_bucket_id
NODE_ENV = "production"
TF_NEXTIMAGE_BASE_ORIGIN = var.next_image_base_origin
TF_NEXTIMAGE_DOMAINS = jsonencode(var.next_image_domains)
TF_NEXTIMAGE_DEVICE_SIZES = var.next_image_device_sizes != null ? jsonencode(var.next_image_device_sizes) : null
TF_NEXTIMAGE_FORMATS = jsonencode(var.next_image_formats)
TF_NEXTIMAGE_IMAGE_SIZES = var.next_image_image_sizes != null ? jsonencode(var.next_image_image_sizes) : null
TF_NEXTIMAGE_DANGEROUSLY_ALLOW_SVG = var.next_image_dangerously_allow_SVG ? jsonencode(var.next_image_dangerously_allow_SVG) : null
TF_NEXTIMAGE_CONTENT_SECURITY_POLICY = var.next_image_content_security_policy != null ? jsonencode(var.next_image_content_security_policy) : null
TF_NEXTIMAGE_SOURCE_BUCKET = var.source_bucket_id
}

create_package = false
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ variable "next_image_image_sizes" {
default = null
}

variable "next_image_dangerously_allow_SVG" {
description = "Enable the optimization of SVG images."
type = bool
default = false
}

variable "next_image_content_security_policy" {
description = "Set the value of the Content-Security-Policy header in the response of the image optimizer."
type = string
default = null
}

variable "lambda_memory_size" {
description = "Amount of memory in MB the worker Lambda Function can use. Valid value between 128 MB to 10,240 MB, in 1 MB increments."
type = number
Expand Down

0 comments on commit 942e1c7

Please sign in to comment.