Skip to content
Permalink
Browse files

Pass environment variables from systemd service for mailserver config

  • Loading branch information...
lovett committed Jun 25, 2019
1 parent 997f35f commit ca9cebd3dd74be6824275ba964989f78aa5b8892
Showing with 10 additions and 10 deletions.
  1. +2 −1 ansible/templates/systemd-service.j2
  2. +3 −3 config/mail.php
  3. +5 −6 mkimage.sh
@@ -2,7 +2,8 @@
Description={{ application_name|capitalize }}

[Service]
ExecStart=/usr/bin/podman run --rm --name {{ application_name }} -v {{ application_name }}_data:/srv/www/storage --publish 127.0.0.1:8102:80 {{ application_name }}
ExecStart=/usr/bin/podman run --rm --name {{ application_name }} --env MAIL_HOST={{ mail_host }} --env MAIL_USERNAME={{ mail_username }} --env MAIL_PASSWORD={{ mail_password }} --env MAIL_FROM_ADDRESS={{ mail_from_address }} --env MAIL_FROM_NAME={{ mail_from_name }} -v {{ application_name }}_data:/srv/www/storage --publish 127.0.0.1:8102:80 {{ application_name }}


ExecStop=/usr/bin/podman stop -t 10 {{ application_name }}

@@ -29,7 +29,7 @@
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'host' => env('MAIL_HOST'),
/*
|--------------------------------------------------------------------------
@@ -56,8 +56,8 @@
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
'address' => env('MAIL_FROM_ADDRESS'),
'name' => env('MAIL_FROM_NAME'),
],
/*
@@ -123,6 +123,9 @@ php artisan key:generate
# process. That file exists on the container filesytem and is
# temporary. This one exists in the data volume mounted on
# /srv/www/storage, and is permanent.
#
# The call to artisan config:cache happens here so that environment
# variables are picked up when the container is started.
cat <<EOF > "$MOUNT/usr/local/sbin/pre-init.sh"
#!/bin/sh
@@ -138,13 +141,9 @@ if [ ! -f storage/toils.sqlite ]; then
fi
php artisan migrate --force --no-interaction
EOF
php artisan config:cache
# Perform Laravel deployment optimizations.
#
# This runs from inside the container out of necessity. If it ran from
# the host, artisan would see file paths relative to the host.
buildah run "$WORK_CONTAINER" /bin/sh -c 'cd /srv/www; php artisan config:cache'
EOF

# The database placeholder is no longer needed.
#

0 comments on commit ca9cebd

Please sign in to comment.
You can’t perform that action at this time.