2018-10-23 10:58:36 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import os
|
2019-01-08 00:38:06 +02:00
|
|
|
import logging as log
|
|
|
|
import sys
|
2019-07-25 10:33:57 +02:00
|
|
|
from socrate import conf
|
2018-12-07 13:37:40 +02:00
|
|
|
|
2019-01-08 05:16:05 +02:00
|
|
|
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
|
2019-01-08 00:38:06 +02:00
|
|
|
|
2018-12-07 13:37:40 +02:00
|
|
|
os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576))
|
|
|
|
|
2019-11-19 13:22:09 +02:00
|
|
|
db_flavor=os.environ.get("ROUNDCUBE_DB_FLAVOR","sqlite")
|
|
|
|
if db_flavor=="sqlite":
|
|
|
|
os.environ["DB_DSNW"]="sqlite:////data/roundcube.db"
|
|
|
|
elif db_flavor=="mysql":
|
|
|
|
os.environ["DB_DSNW"]="mysql://%s:%s@%s/%s" % (
|
|
|
|
os.environ.get("ROUNDCUBE_DB_USER","roundcube"),
|
|
|
|
os.environ.get("ROUNDCUBE_DB_PW"),
|
|
|
|
os.environ.get("ROUNDCUBE_DB_HOST","database"),
|
|
|
|
os.environ.get("ROUNDCUBE_DB_NAME","roundcube")
|
|
|
|
)
|
|
|
|
elif db_flavor=="postgresql":
|
|
|
|
os.environ["DB_DSNW"]="pgsql://%s:%s@%s/%s" % (
|
|
|
|
os.environ.get("ROUNDCUBE_DB_USER","roundcube"),
|
|
|
|
os.environ.get("ROUNDCUBE_DB_PW"),
|
|
|
|
os.environ.get("ROUNDCUBE_DB_HOST","database"),
|
|
|
|
os.environ.get("ROUNDCUBE_DB_NAME","roundcube")
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
print("Unknown ROUNDCUBE_DB_FLAVOR: %s",db_flavor)
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-25 10:33:57 +02:00
|
|
|
conf.jinja("/php.ini", os.environ, "/usr/local/etc/php/conf.d/roundcube.ini")
|
2018-10-23 10:58:36 +02:00
|
|
|
|
|
|
|
# Fix some permissions
|
|
|
|
os.system("mkdir -p /data/gpg")
|
|
|
|
os.system("chown -R www-data:www-data /data")
|
|
|
|
|
|
|
|
# Run apache
|
2019-01-08 00:38:06 +02:00
|
|
|
os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"])
|