Compare commits
9 Commits
db769ca053
...
0.2.16
Author | SHA1 | Date | |
---|---|---|---|
85afd501ce | |||
4dbc156439 | |||
fd3e8751fe | |||
21ea1aa56f
|
|||
eefc8d5b21
|
|||
41010b8a7b | |||
43583fb7f3 | |||
1f5b4163e7 | |||
38d3381ecd
|
@ -10,6 +10,9 @@ steps:
|
|||||||
from_secret: container_registry_username
|
from_secret: container_registry_username
|
||||||
password:
|
password:
|
||||||
from_secret: container_registry_password
|
from_secret: container_registry_password
|
||||||
|
build_args:
|
||||||
|
- VERSION_ID1=${CI_COMMIT_SHA}
|
||||||
|
- VERSION_ID2=${CI_COMMIT_TAG}
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
when:
|
when:
|
||||||
- event: [push, tag]
|
- event: [push, tag]
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
FROM python:3.12-alpine3.19
|
FROM python:3.12-alpine3.19
|
||||||
|
|
||||||
ARG APP_DIR="/opt/app"
|
ARG APP_DIR="/opt/app"
|
||||||
|
ARG VERSION_ID1="x"
|
||||||
|
ARG VERSION_ID2="alpha"
|
||||||
|
|
||||||
COPY ./src/ ${APP_DIR}/
|
COPY ./src/ ${APP_DIR}/
|
||||||
COPY start.sh ${APP_DIR}/
|
COPY start.sh ${APP_DIR}/
|
||||||
@ -9,7 +11,9 @@ WORKDIR ${APP_DIR}
|
|||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apk add --no-cache build-base libpq-dev && \
|
apk add --no-cache build-base libpq-dev && \
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt && \
|
||||||
|
if [ "${VERSION_ID2}" != "" ]; then VERSION_ID=${VERSION_ID2}; else VERSION_ID=${VERSION_ID1}; fi && \
|
||||||
|
sed -i -e 's/VERSION_ID/'$VERSION_ID'/' ${APP_DIR}/templates/index.html
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$ENCRYPTION_KEY" = "" ]; then
|
if [ "$ENCRYPTION_KEY" = "" ]; then
|
||||||
echo "ENCRYPTION_KEY not set"
|
echo "ENCRYPTION_KEY not set"
|
||||||
exit 1
|
exit 1
|
||||||
@ -10,6 +12,7 @@ if [ "$MD5_CHECKSUM" = "" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
SECRETS_CIPHERTEXT_FILE=secrets.enc
|
SECRETS_CIPHERTEXT_FILE=secrets.enc
|
||||||
SECRETS_PLAINTEXT_FILE=/tmp/secrets
|
SECRETS_PLAINTEXT_FILE=/tmp/secrets
|
||||||
TMP_FILE=`mktemp`
|
TMP_FILE=`mktemp`
|
||||||
|
@ -42,7 +42,7 @@ kind: Ingress
|
|||||||
metadata:
|
metadata:
|
||||||
name: nutri
|
name: nutri
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/cluster-issuer: letsencrypt-staging-http
|
cert-manager.io/cluster-issuer: letsencrypt-production-http
|
||||||
spec:
|
spec:
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
if [ "$1" == "test" ]; then
|
if [ "$1" == "test" ]; then
|
||||||
POSTFIX="-test"
|
POSTFIX="-test"
|
||||||
IMAGE_TAG="latest"
|
IMAGE_TAG=${CI_COMMIT_SHA}
|
||||||
else
|
else
|
||||||
POSTFIX=""
|
POSTFIX=""
|
||||||
fi
|
fi
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"client_id": "nutri",
|
"client_id": "nutri",
|
||||||
"client_secret": "%CLIENT_SECRET%",
|
"client_secret": "%CLIENT_SECRET%",
|
||||||
"redirect_uris": [
|
"redirect_uris": [
|
||||||
"https://nutri.hottis.de/*"
|
"https://nutri-test.hottis.de/*"
|
||||||
],
|
],
|
||||||
"userinfo_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/userinfo",
|
"userinfo_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/userinfo",
|
||||||
"token_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/token"
|
"token_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/token"
|
||||||
|
@ -65,7 +65,7 @@ def get_products():
|
|||||||
try:
|
try:
|
||||||
conn = psycopg2.connect()
|
conn = psycopg2.connect()
|
||||||
with conn.cursor() as cursor:
|
with conn.cursor() as cursor:
|
||||||
cursor.execute('SELECT name FROM nutrition_table')
|
cursor.execute('SELECT name FROM nutrition_table ORDER BY name')
|
||||||
products = cursor.fetchall()
|
products = cursor.fetchall()
|
||||||
return {'products': [product[0] for product in products]}
|
return {'products': [product[0] for product in products]}
|
||||||
finally:
|
finally:
|
||||||
|
@ -72,7 +72,7 @@ tr:nth-child(even) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.selected, tr.selected {
|
.selected, tr.selected {
|
||||||
background-color: #e5b5b5; /* Hervorhebung der Auswahl */
|
background-color: #efcccc; /* Hervorhebung der Auswahl */
|
||||||
}
|
}
|
||||||
|
|
||||||
tr:hover:not(.selected) {
|
tr:hover:not(.selected) {
|
||||||
@ -172,7 +172,7 @@ tr:hover:not(.selected) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#database-nutrition-table tr.selected {
|
#database-nutrition-table tr.selected {
|
||||||
background-color: #f0e68c;
|
background-color: #efcccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,6 +177,7 @@ function updateTotalNutrition() {
|
|||||||
<nav id="navbar">
|
<nav id="navbar">
|
||||||
<h1>Elo's Rezept Rechner</h1>
|
<h1>Elo's Rezept Rechner</h1>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li class="versionid">VERSION_ID</li>
|
||||||
<li><a href="/" class="active">Rechner</a></li>
|
<li><a href="/" class="active">Rechner</a></li>
|
||||||
<li><a href="/nutrition">Neue Lebensmittel</a></li>
|
<li><a href="/nutrition">Neue Lebensmittel</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -232,4 +233,4 @@ function updateTotalNutrition() {
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
// Beispielsweise das Formular zurücksetzen
|
// Beispielsweise das Formular zurücksetzen
|
||||||
form.reset();
|
form.reset();
|
||||||
updateSubmitButtonState();
|
updateSubmitButtonState();
|
||||||
|
loadDatabaseEntries();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('Fehler:', error);
|
console.error('Fehler:', error);
|
||||||
});
|
});
|
||||||
@ -98,7 +99,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateDeleteButtonState() {
|
function updateDeleteButtonState() {
|
||||||
const selectedRows = document.querySelectorAll('#nutrition-table .selected').length;
|
const selectedRows = document.querySelectorAll('#database-nutrition-table .selected').length;
|
||||||
const deleteButton = document.getElementById('delete-row-button');
|
const deleteButton = document.getElementById('delete-row-button');
|
||||||
deleteButton.disabled = selectedRows === 0;
|
deleteButton.disabled = selectedRows === 0;
|
||||||
if (selectedRows === 0) {
|
if (selectedRows === 0) {
|
||||||
@ -107,11 +108,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function loadDatabaseEntries() {
|
function loadDatabaseEntries() {
|
||||||
fetch('/get_database_entries') // Pfad zur entsprechenden Flask-Route
|
fetch('/get_database_entries') // Pfad zur entsprechenden Flask-Route
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const tableBody = document.getElementById('database-nutrition-table').getElementsByTagName('tbody')[0];
|
const tableBody = document.getElementById('database-nutrition-table').getElementsByTagName('tbody')[0];
|
||||||
|
tableBody.innerHTML = '';
|
||||||
data.forEach(entry => {
|
data.forEach(entry => {
|
||||||
const row = tableBody.insertRow();
|
const row = tableBody.insertRow();
|
||||||
row.insertCell(0).innerHTML = entry.food;
|
row.insertCell(0).innerHTML = entry.food;
|
||||||
|
Reference in New Issue
Block a user