Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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 2 packages/engine/src/types/aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const ConfigContainerSchema = z
.object({
src: z.string().describe('Path to the container source code'),
environment: z
.record(JSONValue)
.record(z.string(), JSONValue)
.optional()
.describe('Environment variables to pass to the container'),
compute: ConfigContainerCompute.describe(
Expand Down
82 changes: 82 additions & 0 deletions 82 packages/engine/test/schemaValidation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ConfigEssential,
ConfigDeploymentAwsApi,
} from '../src/types.js'
import { ConfigContainerSchema as ConfigContainerSchemaAws } from '../src/types/aws.js'

describe('Scaling Schema: Custom Error Messages', () => {
describe('ConfigContainerAwsFargateEcsScaleSchema - min/max error messages', () => {
Expand Down Expand Up @@ -272,3 +273,84 @@ describe('ZodError Structure: Issue Format', () => {
expect(issue.keys).toContain('notAllowed')
})
})

describe('ConfigContainerSchema (aws.js): Environment Variables', () => {
test('should accept container config with environment variables', () => {
const containerConfig = {
src: './',
environment: {
NODE_ENV: 'production',
API_KEY: 'secret123',
PORT: 3000,
DEBUG: true,
},
compute: {
type: 'awsFargateEcs',
awsFargateEcs: {
memory: 8192,
cpu: 1024,
scale: [{ type: 'desired', desired: 2 }],
},
},
routing: {
pathPattern: '/*',
pathHealthCheck: '/_health',
},
}

const result = ConfigContainerSchemaAws.safeParse(containerConfig)
expect(result.success).toBe(true)
})

test('should accept deeply nested environment values', () => {
const containerConfig = {
src: './',
environment: {
SIMPLE: 'value',
NESTED: {
key1: 'value1',
key2: {
deep: 'nested',
array: [1, 2, 3],
},
},
},
compute: {
type: 'awsFargateEcs',
awsFargateEcs: {
memory: 512,
cpu: 256,
scale: [{ type: 'desired', desired: 1 }],
},
},
routing: {
pathPattern: '/*',
pathHealthCheck: '/_health',
},
}

const result = ConfigContainerSchemaAws.safeParse(containerConfig)
expect(result.success).toBe(true)
})

test('should accept container config without environment variables', () => {
const containerConfig = {
src: './',
compute: {
type: 'awsFargateEcs',
awsFargateEcs: {
memory: 512,
cpu: 256,
scale: [{ type: 'desired', desired: 1 }],
},
},
routing: {
pathPattern: '/*',
pathHealthCheck: '/_health',
},
}

const result = ConfigContainerSchemaAws.safeParse(containerConfig)
expect(result.success).toBe(true)
})
})
Morty Proxy This is a proxified and sanitized view of the page, visit original site.