-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added SSL - OpenFoodFacts API - Product names will link to OpenFoodFacts (If exists) - Option to manually type barcode (with Fetch to pull this from OpenFoodFacts) - Scan Barcode (ability to use phone's camera to scan the barcode and search OpenFoodFacts) **If the product does not exist when scanned or fetched, user prompt to manually complete form**
- Loading branch information
Showing
11 changed files
with
459 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,45 @@ | ||
#!/usr/bin/with-contenv bash | ||
# Start the Flask app | ||
# Start the Flask app with SSL | ||
|
||
# No need to activate the virtual environment; PATH is set | ||
python /opt/webapp/app.py | ||
# Enable debug mode for the shell script (optional but helpful for troubleshooting) | ||
set -x | ||
|
||
# Define absolute paths to the SSL certificates | ||
CERT_FILE="/config/pantry_data/keys/cert.pem" | ||
KEY_FILE="/config/pantry_data/keys/key.pem" | ||
|
||
# Ensure the keys directory exists | ||
mkdir -p /config/pantry_data/keys | ||
|
||
# Function to generate self-signed SSL certificates | ||
generate_certificates() { | ||
echo "Generating self-signed SSL certificates..." | ||
openssl req -x509 -newkey rsa:4096 -nodes \ | ||
-keyout "$KEY_FILE" -out "$CERT_FILE" \ | ||
-days 365 -subj "/CN=localhost" | ||
if [ $? -eq 0 ]; then | ||
echo "Certificates generated successfully at $CERT_FILE and $KEY_FILE" | ||
else | ||
echo "Failed to generate SSL certificates." | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Check if certificates already exist | ||
if [ ! -f "$CERT_FILE" ] || [ ! -f "$KEY_FILE" ]; then | ||
generate_certificates | ||
else | ||
echo "SSL certificates already exist. Skipping generation." | ||
fi | ||
|
||
# Verify that certificates exist after generation | ||
if [ -f "$CERT_FILE" ] && [ -f "$KEY_FILE" ]; then | ||
echo "SSL certificates are present." | ||
else | ||
echo "Failed to generate SSL certificates." | ||
exit 1 | ||
fi | ||
|
||
# Start the Flask app with SSL using exec to replace the shell with the Flask process | ||
echo "Starting Flask app with SSL..." | ||
exec python /opt/webapp/app.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ SQLAlchemy | |
portalocker | ||
marshmallow | ||
sqlalchemy | ||
|
||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.