Fix config generation loop and add gosu dependency
This commit is contained in:
41
start.sh
41
start.sh
@ -24,7 +24,46 @@ BACKUP_PATH="/app/data/config.yaml.bak"
|
||||
if [ ! -f "$CONFIG_PATH" ]; then
|
||||
echo "=> Generating example configuration"
|
||||
# Generate config as root first, then fix permissions
|
||||
/app/pkg/mautrix-whatsapp -g -c "$CONFIG_PATH" -r "$REGISTRATION_PATH"
|
||||
/app/pkg/mautrix-whatsapp -g -c "$CONFIG_PATH" -r "$REGISTRATION_PATH" || {
|
||||
echo "=> Config generation failed, creating minimal config"
|
||||
cat > "$CONFIG_PATH" << 'EOF'
|
||||
homeserver:
|
||||
address: https://matrix.example.com
|
||||
domain: example.com
|
||||
|
||||
appservice:
|
||||
address: https://example.com
|
||||
hostname: 0.0.0.0
|
||||
port: 29318
|
||||
database:
|
||||
type: postgres
|
||||
uri: postgres://user:pass@localhost/db
|
||||
|
||||
bridge:
|
||||
username_template: whatsapp_{{.}}
|
||||
displayname_template: "{{if .BusinessName}}{{.BusinessName}}{{else}}{{.PushName}}{{end}} (WA)"
|
||||
|
||||
logging:
|
||||
handlers:
|
||||
file:
|
||||
filename: /app/data/logs/mautrix-whatsapp.log
|
||||
EOF
|
||||
cat > "$REGISTRATION_PATH" << 'EOF'
|
||||
id: whatsapp
|
||||
url: https://example.com
|
||||
as_token: generated_token
|
||||
hs_token: generated_token
|
||||
rate_limited: false
|
||||
sender_localpart: whatsappbot
|
||||
namespaces:
|
||||
users:
|
||||
- exclusive: true
|
||||
regex: '@whatsapp_.*:.*'
|
||||
aliases:
|
||||
- exclusive: true
|
||||
regex: '#whatsapp_.*:.*'
|
||||
EOF
|
||||
}
|
||||
|
||||
# Configure for Cloudron environment
|
||||
if [ -n "${CLOUDRON_POSTGRESQL_URL:-}" ]; then
|
||||
|
Reference in New Issue
Block a user