Set (sub)domain name via environment
diff --git a/simpleid/Dockerfile.entrypoint b/simpleid/Dockerfile.entrypoint
index f98185b..fd85408 100644
--- a/simpleid/Dockerfile.entrypoint
+++ b/simpleid/Dockerfile.entrypoint
@@ -2,8 +2,31 @@
 
 set -e
 
+{
+    domain=${SA_PUBLIC_DOMAIN_NAME:-miau.local}
+    ids=/var/db/simpleid
+    html=/var/www/html
+
+    mkdir -p ${ids}
+    rm -rf ${html}
+    cp -a /var/www/simpleid ${html}
+
+    for tmpl in /var/db/simpleid-templates/*.identity; do
+        id=$(basename ${tmpl})
+        sed "s/miau.local/${domain}/" ${tmpl} >${ids}/${id}
+    done
+
+    for f in /var/www/simpleid/config.php; do
+        sed "s/miau.local/${domain}/" ${f} >${html}/$(basename ${f})
+    done
+}
+
 chown -R www-data:www-data /var/cache/simpleid/
 chown -R www-data:www-data /var/lib/simpleid/
+chown -R www-data:www-data /var/db/simpleid/
+chown -R www-data:www-data /var/www/html/
 chown -R www-data:www-data /var/log/
 
+chmod -R a-w /var/db/simpleid/ /var/www/html/
+
 exec docker-php-entrypoint php-fpm "$@"