File tree 5 files changed +17
-12
lines changed
5 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -63,10 +63,14 @@ aws cloudformation deploy \
63
63
--parameter-overrides ServerSourceS3Key=$SOURCE_ZIP
64
64
65
65
printf " \n>>> Saving the CloudFormation output to a JSON file...\n"
66
- aws cloudformation describe-stacks --stack-name GameroomStack | jq " .Stacks[0].Outputs | map({(.OutputKey): .OutputValue}) | add" > frontend/src/api_endpoints.json
66
+
67
+ aws cloudformation describe-stacks \
68
+ --stack-name GameroomStack \
69
+ | jq -r ' (.Stacks[0].Outputs)[] | "REACT_APP_\(.OutputKey | gsub("(?<a>[a-z])(?<b>[A-Z])"; "\(.a)_\(.b)") | ascii_upcase)=\(.OutputValue)"' \
70
+ > frontend/.env
67
71
68
72
printf " \n>>> The output of CloudFormation is:\n"
69
- cat frontend/src/api_endpoints.json
73
+ cat frontend/.env
70
74
71
75
# Enter /frontend
72
76
pushd frontend
Original file line number Diff line number Diff line change @@ -662,7 +662,3 @@ Outputs:
662
662
Value : !GetAtt ApiGatewayApiHttp.ApiEndpoint
663
663
WebSocketEndpointUrl :
664
664
Value : !Join ["/", [!GetAtt ApiGatewayApiWebSocket.ApiEndpoint, staging]]
665
- S3BucketFrontEndName :
666
- Value : !Ref S3BucketFrontEnd
667
- CloudFrontDomainName :
668
- Value : !GetAtt CloudFrontDistribution.DomainName
Original file line number Diff line number Diff line change 1
1
import { Delta , Snapshot } from "shared-models" ;
2
2
3
- import endpoints from "../api_endpoints.json " ;
3
+ import { HTTP_ENDPOINT_URL } from "../constants " ;
4
4
5
5
export async function createRoom ( ) : Promise <
6
6
| {
@@ -12,7 +12,7 @@ export async function createRoom(): Promise<
12
12
roomData : { roomId : string } ;
13
13
}
14
14
> {
15
- const response = await fetch ( `${ endpoints . HttpEndpointUrl } /rooms` , {
15
+ const response = await fetch ( `${ HTTP_ENDPOINT_URL } /rooms` , {
16
16
method : "POST" ,
17
17
mode : "cors" ,
18
18
} ) ;
@@ -38,7 +38,7 @@ export async function getRoomSnapshot(
38
38
roomId : string
39
39
) : Promise < GetRoomSnapsotResponse > {
40
40
const response = await fetch (
41
- `${ endpoints . HttpEndpointUrl } /rooms/${ roomId } /snapshot` ,
41
+ `${ HTTP_ENDPOINT_URL } /rooms/${ roomId } /snapshot` ,
42
42
{
43
43
method : "GET" ,
44
44
mode : "cors" ,
@@ -64,7 +64,7 @@ export async function getRoomDeltas(
64
64
toSeq : number
65
65
) : Promise < Delta [ ] > {
66
66
const response = await fetch (
67
- `${ endpoints . HttpEndpointUrl } /rooms/${ roomId } /deltas?fromSeq=${ fromSeq } &toSeq=${ toSeq } ` ,
67
+ `${ HTTP_ENDPOINT_URL } /rooms/${ roomId } /deltas?fromSeq=${ fromSeq } &toSeq=${ toSeq } ` ,
68
68
{
69
69
method : "GET" ,
70
70
mode : "cors" ,
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import {
19
19
isLeaderSelectionMessage ,
20
20
} from "shared-models" ;
21
21
22
- import endpoints from "../api_endpoints.json " ;
22
+ import { WEB_SOCKET_ENDPOINT_URL } from "../constants " ;
23
23
import Logger from "../utils/Logger" ;
24
24
25
25
class WebSocketManager {
@@ -39,7 +39,7 @@ class WebSocketManager {
39
39
// Cannot provide specific type for WebSocketSubject because the provided
40
40
// type definition force incoming and outgoing message to be the same type.
41
41
this . webSocketSubject = webSocket < any > ( {
42
- url : endpoints . WebSocketEndpointUrl ,
42
+ url : WEB_SOCKET_ENDPOINT_URL ,
43
43
openObserver : {
44
44
next : ( ) => {
45
45
this . logger . debug ( "^^^ connection open" ) ;
Original file line number Diff line number Diff line change
1
+ export const HTTP_ENDPOINT_URL = process . env
2
+ . REACT_APP_HTTP_ENDPOINT_URL as string ;
3
+
4
+ export const WEB_SOCKET_ENDPOINT_URL = process . env
5
+ . REACT_APP_WEB_SOCKET_ENDPOINT_URL as string ;
You can’t perform that action at this time.
0 commit comments