Skip to content

Commit

Permalink
Merge pull request #28 from lpsinger/search-pragma
Browse files Browse the repository at this point in the history
Support serverless deployments with `@search` pragma
  • Loading branch information
dakota002 authored Nov 28, 2023
2 parents 3e1379c + 7803d00 commit c1f540c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ function toCollectionName(name: string) {
.slice(0, 32)
}

function getConfig(arc: {
search?: string[][]
}): Record<string, string | undefined> {
if (arc.search) return Object.fromEntries(arc.search)
else return {}
}

export const deploy = {
// @ts-expect-error: The Architect plugins API has no type definitions.
start({ cloudformation, inventory, arc, stage }) {
let resources
if (arc.search) {
resources = serviceCloudformationResources(Object.fromEntries(arc.search))
const config = getConfig(arc)
if (config.availabilityZoneCount) {
resources = serviceCloudformationResources(config)
} else {
const { app } = inventory.inv
const collectionName = toCollectionName(`${app}-${stage}`)
Expand Down

0 comments on commit c1f540c

Please sign in to comment.