-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtemplate.yaml
More file actions
69 lines (66 loc) · 1.76 KB
/
template.yaml
File metadata and controls
69 lines (66 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: MathCAT Demo TTS proxy (Polly, Google, Azure)
Parameters:
AllowedOrigins:
Type: String
Default: 'https://daisy.github.io,http://localhost:8080,http://127.0.0.1:8080'
Description: Comma-separated browser origins allowed to call this API
TtsProvider:
Type: String
Default: polly
AllowedValues:
- polly
- google
- azure
Description: Active speech engine for the proxy
AzureSpeechKey:
Type: String
Default: ''
NoEcho: true
AzureSpeechRegion:
Type: String
Default: ''
GoogleServiceAccountJson:
Type: String
Default: ''
NoEcho: true
Resources:
TtsFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: .
Handler: index.handler
Runtime: nodejs24.x
Architectures:
- arm64
Timeout: 30
MemorySize: 512
Environment:
Variables:
ALLOWED_ORIGINS: !Ref AllowedOrigins
TTS_PROVIDER: !Ref TtsProvider
AZURE_SPEECH_KEY: !Ref AzureSpeechKey
AZURE_SPEECH_REGION: !Ref AzureSpeechRegion
GOOGLE_SERVICE_ACCOUNT_JSON: !Ref GoogleServiceAccountJson
Policies:
- Statement:
- Effect: Allow
Action:
- polly:SynthesizeSpeech
Resource: '*'
Events:
TtsPost:
Type: HttpApi
Properties:
Path: /tts
Method: POST
TtsOptions:
Type: HttpApi
Properties:
Path: /tts
Method: OPTIONS
Outputs:
TtsApiUrl:
Description: POST endpoint for the MathCAT demo frontend
Value: !Sub 'https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/tts'