Enhance: entrypoint

This commit is contained in:
2025-12-19 22:21:14 +09:00
parent 58f82399ed
commit a879ee84bf
+20 -16
View File
@@ -2,30 +2,34 @@
set -e set -e
# Check required env # Check required env
if [ -z "$UWUZU_HOST" ] || [ -z "$UWUZU_TOKEN" ] || [ -z "$UWUZU_HOST" ] || [ -z "$UWUZU_TOKEN" ] && {
[ -z "$TWEET_ENABLED" ] || [ -z "$CHECK_INTERVAL" ] || [ -z "$THINK_OUTPUT_ENABLED" ]; then echo "Error: Required environment variable not set"
echo "Error: The environment variable is not set"
exit 1 exit 1
fi }
# Set default env
: "${TWEET_ENABLED:=true}"
: "${CHECK_INTERVAL:=300}"
: "${THINK_OUTPUT_ENABLED:=false}"
# Change line break # Change line break
find /app -type d -name "node_modules" -prune -o \ find /app -type d -name node_modules -prune -o \
-type f -name "*.js" -exec sed -i 's/\r$//' {} \; -type f -name '*.js' -exec sed -i 's/\r$//' {} +
# Copy default memory # Copy default memory
if [ ! -s /app/memory.db ]; then \ [ -s /app/memory.db ] || {
cp /app/memory.default.db /app/memory.db; \ cp /app/memory.default.db /app/memory.db
rm -f /app/memory.default.db; \ rm -f /app/memory.default.db
fi }
# Create config.json # Create config.json
cat <<EOF > /app/config.json cat > /app/config.json <<EOF
{ {
"host": "${UWUZU_HOST}", "host": "$UWUZU_HOST",
"api_token": "${UWUZU_TOKEN}", "api_token": "$UWUZU_TOKEN",
"random_ueuse": ${TWEET_ENABLED}, "random_ueuse": $TWEET_ENABLED,
"check_interval": ${CHECK_INTERVAL}, "check_interval": $CHECK_INTERVAL,
"rana_core_log": ${THINK_OUTPUT_ENABLED} "rana_core_log": $THINK_OUTPUT_ENABLED
} }
EOF EOF