Example of using environmental variables
- docker (https://hub.docker.com/)
From a terminal
git clone https://github.com/sketchings/example-env.git
(or use ssh)cd example-env
docker run --rm -v $(pwd):/app composer install
docker-compose up
- Rename
example.env
to.env
In a new terminal
docker exec -it example-env_db_1 bash -l
mysql
use env-test;
CREATE TABLE custom_vars ( var_id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, var_name VARCHAR(100) NOT NULL, var_value VARCHAR(100) NOT NULL, var_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP );
INSERT INTO custom_vars (var_name, var_value) Values('group','phpdx');
- You can close this terminal
In a browser visit http://127.0.0.1/