-
Notifications
You must be signed in to change notification settings - Fork 78
Add email (OTP) credentials setup to init scripts #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,10 +180,23 @@ while ($true) { | |
| } | ||
| } | ||
|
|
||
| # appwrite push functions --with-variables | ||
| Write-Host "Setting Up Email for OTP now ..." | ||
| Write-Host "This email will be used to send OTP verification codes to users." | ||
| $senderMail = Read-Host "Please provide sender email address (e.g., [email protected])" | ||
| $senderPassword = Read-Host "Please provide sender email app password" -AsSecureString | ||
| $senderPasswordPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($senderPassword)) | ||
|
|
||
| # Push Email credentials as env variables for functions to use | ||
| Write-Host "Pushing Email credentials as env variables..." | ||
| appwrite project create-variable --key SENDER_MAIL --value $senderMail | ||
| appwrite project create-variable --key SENDER_PASSWORD --value $senderPasswordPlain | ||
|
Comment on lines
+192
to
+193
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that environment variables are created successfully. The script doesn't check whether the Run the following script to check if similar error handling exists elsewhere in the codebase: 🏁 Script executed: #!/bin/bash
# Description: Check if other appwrite commands in init scripts have error handling
# Search for appwrite commands and their error handling patterns
rg -n -A2 -B2 'appwrite project create-variable' init.ps1 init.shLength of output: 4143 Add error handling to verify environment variable creation succeeds before continuing. The review comment is valid. Neither init.sh nor init.ps1 implement any error checks after executing If these commands fail silently, critical credentials won't be set, yet the script will report success and continue, leaving cloud functions without required authentication. Add conditional checks (e.g., 🤖 Prompt for AI Agents |
||
| Write-Host "Email credentials configured successfully!" | ||
|
|
||
| # Push Livekit credentials as env variables for functions to use | ||
| Write-Host "Pushing Livekit credentials as env variables if you need any changes do them in your Appwrite Resonate project's Global Env variables" | ||
| appwrite project create-variable --key LIVEKIT_HOST --value $livekitHostURL | ||
| appwrite project create-variable --key LIVEKIT_SOCKET_URL --value $livekitSocketURL | ||
| appwrite project create-variable --key LIVEKIT_API_KEY --value $livekitAPIKey | ||
| appwrite project create-variable --key LIVEKIT_API_SECRET --value $livekitAPISecret | ||
| appwrite push functions --with-variables | ||
| appwrite push functions --with-variables | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,6 +127,19 @@ echo "Pushing Meilisearch credentials as env variables if you need any changes d | |
| appwrite project create-variable --key MEILISEARCH_ENDPOINT --value "$meilisearchEndpoint" | ||
| appwrite project create-variable --key MEILISEARCH_ADMIN_API_KEY --value "$meilisearchMasterKey" | ||
|
|
||
| ## appwrite push functions --with-variables | ||
| echo "Setting Up Email for OTP now ..." | ||
| echo "This email will be used to send OTP verification codes to users." | ||
| read -p "Please provide sender email address (e.g., [email protected]): " senderMail | ||
| read -sp "Please provide sender email app password: " senderPassword | ||
| echo "" | ||
|
|
||
| # Push Email credentials as env variables for functions to use | ||
| echo "Pushing Email credentials as env variables..." | ||
| appwrite project create-variable --key SENDER_MAIL --value "$senderMail" | ||
| appwrite project create-variable --key SENDER_PASSWORD --value "$senderPassword" | ||
|
Comment on lines
+139
to
+140
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that environment variables are created successfully. The script doesn't check whether the Run the following script to verify the pattern used elsewhere in init.sh: 🏁 Script executed: #!/bin/bash
# Description: Check error handling patterns for appwrite commands in init.sh
# Search for appwrite commands and check if any have error handling
rg -n -C3 'appwrite project create-variable.*\|\||\&\& \[|if \[' init.shLength of output: 2361 I need to examine the actual code context around lines 139-140 and search for all Now let me examine the actual init.sh file to see the code context: 🏁 Script executed: #!/bin/bash
# Get the content around lines 139-140 and show all appwrite project create-variable calls
# Show lines around 139-140
echo "=== Lines around 139-140 in init.sh ==="
sed -n '130,150p' init.sh
echo -e "\n=== All appwrite project create-variable calls in init.sh ==="
rg -n 'appwrite project create-variable' init.sh -A1 -B1Length of output: 201 I need to locate init.sh in the repository first: 🏁 Script executed: #!/bin/bash
# Find init.sh location in repository
fd 'init\.sh' --type f
# Once found, get content around lines 139-140 and all appwrite project create-variable calls
echo -e "\n=== Searching for init.sh and extracting content ==="
init_file=$(fd 'init\.sh' --type f | head -1)
if [ -n "$init_file" ]; then
echo "Found init.sh at: $init_file"
echo -e "\n=== Lines around 139-140 ==="
sed -n '130,150p' "$init_file"
echo -e "\n=== All appwrite project create-variable calls ==="
rg -n 'appwrite project create-variable' "$init_file" -A1 -B1
else
echo "init.sh not found"
fiLength of output: 2676 Add error handling to email credential setup commands at lines 139-140. Your observation is verified and accurate. None of the 10 Add checks after both commands: Consider applying the same pattern to other critical variable creation calls (lines 71, 75, 127-128, 186-189) for consistency and robustness. 🤖 Prompt for AI Agents |
||
| echo "Email credentials configured successfully!" | ||
|
|
||
|
|
||
| echo "Setting Up Livekit now ..." | ||
| while true; do | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As suggested by CodeRabbit, please add checks to ensure that the senderMail and senderPassword inputs were entered before moving forward. stay in a read loop until they are entered.