Files
nginx-php-fpm/docs/scripting_templating.md
2018-09-28 21:11:22 +02:00

965 B

Scripting

There is often an occasion where you need to run a script on code to do a transformation once code lands in the container. For this reason we have developed scripting support. By including a scripts folder in your git repository and passing the RUN_SCRIPTS=1 flag to your command line the container will execute your scripts. Please see the repo layout guidelines for more details on how to organise this. In addition, you can configure SCRIPT_FOLDER with your custome path.

Using environment variables / templating

To set the variables pass them in as environment variables on the docker command line. Example:

sudo docker run -d -e 'YOUR_VAR=VALUE' richarvey/nginx-php-fpm

You can then use PHP to get the environment variable into your code:

string getenv ( string $YOUR_VAR )

Another example would be:

<?php
echo $_ENV["APP_ENV"];
?>