You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aruppi-api/entrypoint.sh

34 lines
928 B
Bash

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/sh
# Check if MONGO_CONNECTION_STRING is defined
if [ -z "$MONGO_CONNECTION_STRING" ]; then
echo "ERROR: The environment variable for the database, MONGO_CONNECTION_STRING is not defined."
exit 1
fi
# Verificar si MONGO_DATABASE_NAME está definido
if [ -z "$MONGO_DATABASE_NAME" ]; then
echo "WARNING: The environment variable for the database, MONGO_DATABASE_NAME, is not defined. It is using mongodb as the default value."
MONGO_DATABASE_NAME="mongodb"
fi
# Generate the application.yaml file
cat <<EOF > /app/application.yaml
ktor:
application:
modules:
- com.jeluchu.ApplicationKt.module
deployment:
port: 8080
host: "0.0.0.0"
db:
mongo:
connectionStrings: "${MONGO_CONNECTION_STRING}"
database:
name: "${MONGO_DATABASE_NAME:-mongodb}"
EOF
# Run the application with the specified configuration
exec java -Dconfig.file=/app/application.yaml -jar /app/app.jar