Skip to content

Commit

Permalink
Put documentation back in
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Feb 27, 2024
1 parent 2cb3ecf commit 5abc34c
Showing 1 changed file with 73 additions and 69 deletions.
142 changes: 73 additions & 69 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Description: >
Globals:
Function:
CodeUri: ./node/src
Runtime: nodejs16.x
Runtime: nodejs18.x
Architectures:
- x86_64
MemorySize: 128
Expand Down Expand Up @@ -120,10 +120,10 @@ Resources:
Description: Dependencies for API handlers
ContentUri: ./layers/api_dependencies
CompatibleRuntimes:
- nodejs16.x
- nodejs18.x
LicenseInfo: Apache-2.0
Metadata:
BuildMethod: nodejs16.x
BuildMethod: nodejs18.x
# V2 API
getAuthCallbackFunction:
Type: AWS::Serverless::Function
Expand Down Expand Up @@ -999,71 +999,75 @@ Resources:
Type: AWS::Serverless::HttpApi
Properties:
StageName: latest
# rootRedirect:
# Type: AWS::Serverless::Function
# Properties:
# CodeUri: ./redirect
# Handler: index.handler
# Timeout: 1
# Description: Redirects to latest version of docs
# Environment:
# Variables:
# REDIRECT_TO: /docs/v2/index.html
# Events:
# RedirectApiGet:
# Type: HttpApi
# Properties:
# ApiId: !Ref rootApi
# Path: /
# Method: GET
# RedirectApiHead:
# Type: HttpApi
# Properties:
# ApiId: !Ref rootApi
# Path: /
# Method: HEAD
rootRedirect:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./node/redirect
Handler: index.handler
Timeout: 1
Description: Redirects to latest version of docs
Environment:
Variables:
REDIRECT_TO: /docs/v2/index.html
Events:
RedirectApiGet:
Type: HttpApi
Properties:
ApiId: !Ref rootApi
Path: /
Method: GET
RedirectApiHead:
Type: HttpApi
Properties:
ApiId: !Ref rootApi
Path: /
Method: HEAD

# Documentation
# docsMapping:
# Type: AWS::ApiGatewayV2::ApiMapping
# Properties:
# DomainName: !Sub "${CustomDomainHost}.${CustomDomainZone}"
# ApiId: !Ref rootApi
# Stage: !Ref rootApilatestStage
# DependsOn: dcApi
# docsBucket:
# Type: AWS::S3::Bucket
# Properties:
# BucketName: !Sub "${CustomDomainHost}-docs.${CustomDomainZone}"
# AccessControl: PublicRead
# WebsiteConfiguration:
# IndexDocument: index.html
# ErrorDocument: index.html
# docsBucketPolicy:
# Type: AWS::S3::BucketPolicy
# Properties:
# PolicyDocument:
# Id: MyPolicy
# Version: 2012-10-17
# Statement:
# - Sid: PublicReadForGetBucketObjects
# Effect: Allow
# Principal: "*"
# Action: "s3:GetObject"
# Resource: !Sub "arn:aws:s3:::${docsBucket}/*"
# Bucket: !Ref docsBucket
# docsIntegration:
# Type: AWS::ApiGatewayV2::Integration
# Properties:
# ApiId: !Ref rootApi
# IntegrationMethod: GET
# IntegrationType: HTTP_PROXY
# IntegrationUri: !Sub "http://${docsBucket}.s3-website-us-east-1.amazonaws.com/{proxy}"
# PayloadFormatVersion: "1.0"
# docsRoute:
# Type: AWS::ApiGatewayV2::Route
# Properties:
# ApiId: !Ref rootApi
# AuthorizationType: NONE
# RouteKey: GET /docs/v2/{proxy+}
# Target: !Sub "integrations/${docsIntegration}"
docsMapping:
Type: AWS::ApiGatewayV2::ApiMapping
Properties:
DomainName: !Sub "${CustomDomainHost}.${CustomDomainZone}"
ApiId: !Ref rootApi
Stage: !Ref rootApilatestStage
DependsOn: dcApi
docsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "${CustomDomainHost}-docs.${CustomDomainZone}"
PublicAccessBlockConfiguration:
BlockPublicAcls: false
BlockPublicPolicy: false
IgnorePublicAcls: false
RestrictPublicBuckets: false
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: index.html
docsBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
Id: MyPolicy
Version: 2012-10-17
Statement:
- Sid: PublicReadForGetBucketObjects
Effect: Allow
Principal: "*"
Action: "s3:GetObject"
Resource: !Sub "arn:aws:s3:::${docsBucket}/*"
Bucket: !Ref docsBucket
docsIntegration:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId: !Ref rootApi
IntegrationMethod: GET
IntegrationType: HTTP_PROXY
IntegrationUri: !Sub "http://${docsBucket}.s3-website-us-east-1.amazonaws.com/{proxy}"
PayloadFormatVersion: "1.0"
docsRoute:
Type: AWS::ApiGatewayV2::Route
Properties:
ApiId: !Ref rootApi
AuthorizationType: NONE
RouteKey: GET /docs/v2/{proxy+}
Target: !Sub "integrations/${docsIntegration}"

0 comments on commit 5abc34c

Please sign in to comment.