Skip to content

Commit

Permalink
Support serverless deployments with @search pragma
Browse files Browse the repository at this point in the history
We're going to add some more configs to the `@search` pragma to
adjust sandbox settings, so we can no longer use the presence or
absence of the pragma itself to determine whether to deploy to
service mode or serverless mode.
  • Loading branch information
lpsinger committed Nov 27, 2023
1 parent 75cfc4d commit e567191
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 e567191

Please sign in to comment.