copy .env file to instance

This commit is contained in:
Evan
2025-03-06 20:49:59 -08:00
parent edcfac2fe7
commit 56e84c3679
5 changed files with 8 additions and 5 deletions
-2
View File
@@ -234,11 +234,9 @@ async function schedulePublicGame() {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Internal-Request": "true",
[config.adminHeader()]: config.adminToken(),
},
body: JSON.stringify({
gameID: gameID,
gameConfig: defaultGameConfig,
}),
},
+2 -2
View File
@@ -81,10 +81,10 @@ export function startWorker() {
const gc = req.body?.gameConfig as GameConfig;
if (
gc?.gameType == GameType.Public &&
req.headers[config.adminHeader()] != config.adminToken()
req.headers[config.adminHeader()] !== config.adminToken()
) {
console.warn(
`cannot create public game ${id}, ip ${clientIP} not localhost`,
`cannot create public game ${id}, ip ${clientIP} incorrect admin token`,
);
return res.status(400);
}
+4
View File
@@ -84,6 +84,10 @@ chmod +x $UPDATE_SCRIPT
# Copy the update script to the EC2 instance
scp -i $EC2_KEY $UPDATE_SCRIPT $EC2_HOST:$REMOTE_UPDATE_SCRIPT
scp -i $EC2_KEY .env $EC2_HOST:/home/ec2-user/.env
# After copying the .env file, secure it
ssh -i $EC2_KEY $EC2_HOST "chmod 600 /home/ec2-user/.env"
if [ $? -ne 0 ]; then
echo "❌ Failed to copy update script to EC2 instance. Stopping deployment."
exit 1
+1
View File
@@ -69,6 +69,7 @@ docker run -d -p 80:80 \
--log-opt awslogs-group=${LOG_GROUP} \
--log-opt awslogs-create-group=true \
--env GAME_ENV=${ENV} \
--env-file /home/ec2-user/.env \
--name ${CONTAINER_NAME} \
$ECR_REPO