HomeDevCentral

Ensure APP_KEY is defined

Description

Ensure APP_KEY is defined

Summary:
At container launch, a custom application key can be defined with
docker run ... -e APP_KEY=... ... nasqueron/notifications.

If no key is submitted, we run php artisan key:generate after
an an empty .env is created if missing.

If NO_INSTALL is defined, we don't check anything and the application
will fail loudly if no configuration is provided.

Fixes T690.

Test Plan:
Build the image, run it, ensure web application is live.

Create an .env when APP_KEY isn't in the environment.

$ docker run -it nasqueron/notifications
/var/wwwroot/default /var/wwwroot/default
Configuration cache cleared!
Configuration cached successfully!
/var/wwwroot/default
$ docker exec -it prickly_brattain cat .env

APP_KEY=atk8fwTbU4VWYYn9elwkC2DVMVfH712I

OK.


Don't create an .env when APP_KEY is in the environment.

$ docker run -it -e APP_KEY=wazza nasqueron/notifications
$ docker exec -it evil_tesla ls .env
ls: cannot access .env: No such file or directory

OK.

Reviewers: Kaliiixx

Maniphest Tasks: T690

Differential Revision: http://devcentral.nasqueron.org/D258

Details

Provenance
derecksonAuthored on Jan 22 2016, 05:00
Differential Revision
D258: Ensure APP_KEY is defined
Parents
rDNOTIFbacf9390fa39: Creating a rNotif image
Branches
Unknown
Tags
Unknown
Tasks
T690: Ensure APP_KEY is properly defined