Skip to content

Commit 873b45a

Browse files
committed
Switch config to .env
1 parent 28604d8 commit 873b45a

File tree

12 files changed

+86
-41
lines changed

12 files changed

+86
-41
lines changed

.env.example

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
debug=0
2+
3+
recaptcha_secret="get it from Google"
4+
5+
mailer_host=locahost
6+
mailer_port=25
7+
mailer_username=user
8+
mailer_password=pass
9+
mailer_encryption=tls
10+
mailer_auth_mode=""

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
vendor/
22
node_modules/
3-
src/Resources/config/parameters.yml
43
src/Resources/assets/rev-manifest.json
54
ansible/inventories/*
65
ansible/inventories/group_vars/*
76
/web/css
87
/web/js
98
/web/font
9+
/.env

Vagrantfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Vagrant.configure("2") do |config|
1919

2020
config.vm.provider :virtualbox do |v|
2121
v.name = "bicpi-homepage"
22-
v.customize ["modifyvm", :id, "--memory", 512]
22+
v.customize ["modifyvm", :id, "--memory", 1024]
2323
end
2424

2525
config.vm.box = "ubuntu/trusty64"

ansible/inventories/group_vars/web.dist

-8
This file was deleted.

ansible/roles/app/tasks/main.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,4 @@
1111
shell: /usr/local/bin/bower install chdir={{ project_root }}
1212
# - name: Run gulp
1313
# sudo: false
14-
# shell: /usr/local/bin/gulp chdir={{ project_root }}
15-
- name: Copy parameters.yml file
16-
sudo: false
17-
template: src=parameters.tpl dest={{project_root}}/src/Resources/config/parameters.yml mode=644
14+
# shell: /usr/local/bin/gulp chdir={{ project_root }}

ansible/roles/app/templates/parameters.tpl

-11
This file was deleted.

ansible/roles/php5-cli/tasks/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
- name: ensure timezone is set in cli php.ini
66
lineinfile: dest=/etc/php5/cli/php.ini
77
regexp='date.timezone ='
8-
line='date.timezone = {{ timezone }}'
8+
line='date.timezone = {{ timezone }}'
9+

ansible/roles/php5-fpm/tasks/main.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@
1616
- name: ensure timezone is set in fpm php.ini
1717
lineinfile: dest=/etc/php5/fpm/php.ini
1818
regexp='date.timezone ='
19-
line='date.timezone = {{ timezone }}'
19+
line='date.timezone = {{ timezone }}'
20+
21+
- name: ensure xdebug config remote_enable
22+
lineinfile: dest=/etc/php5/mods-available/xdebug.ini
23+
line='xdebug.remote_enable=On'
24+
25+
- name: ensure xdebug config remote_connect_back
26+
lineinfile: dest=/etc/php5/mods-available/xdebug.ini
27+
line='xdebug.remote_connect_back=On'

ansible/vars/common.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
doc_root: /var/www/web
55
sys_packages: ["git"]
66
dist: precise
7-
php_packages: ["php5-cli","php5-intl","php5-curl","php5-gd"]
7+
php_packages: ["php5-cli","php5-intl","php5-curl","php5-gd","php5-xdebug"]

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"symfony/translation": "^2.7",
2121
"symfony/twig-bridge": "^2.7",
2222
"symfony/yaml": "^2.7",
23-
"symfony/security": "^2.7"
23+
"symfony/security": "^2.7",
24+
"vlucas/phpdotenv": "^2.0"
2425
}
2526
}

composer.lock

+47-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/index.php

+12-11
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
use Symfony\Component\Translation\Loader\YamlFileLoader;
1111

1212
$app = new Silex\Application();
13-
$app['parameters'] = Yaml::parse(
14-
file_get_contents(__DIR__.'/../src/Resources/config/parameters.yml')
15-
);
16-
$app['debug'] = $app['parameters']['debug'];
13+
14+
$dotenv = new Dotenv\Dotenv(__DIR__.'/..');
15+
$dotenv->load();
16+
17+
$app['debug'] = getenv('debug');
1718
if ($app['debug']) {
1819
ini_set('display_errors', true);
1920
error_reporting(-1);
@@ -35,12 +36,12 @@
3536
});
3637
$app->register(new Silex\Provider\SwiftmailerServiceProvider(), [
3738
'swiftmailer.options' => [
38-
'host' => $app['parameters']['mailer_host'],
39-
'port' => $app['parameters']['mailer_port'],
40-
'username' => $app['parameters']['mailer_username'],
41-
'password' => $app['parameters']['mailer_password'],
42-
'encryption' => $app['parameters']['mailer_encryption'],
43-
'auth_mode' => $app['parameters']['mailer_auth_mode'],
39+
'host' => getenv('mailer_host'),
40+
'port' => getenv('mailer_port'),
41+
'username' => getenv('mailer_username'),
42+
'password' => getenv('mailer_password'),
43+
'encryption' => getenv('mailer_encryption'),
44+
'auth_mode' => getenv('mailer_auth_mode'),
4445
]
4546
]);
4647
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
@@ -102,7 +103,7 @@
102103
if ('POST' == $request->getMethod()) {
103104
$form->bind($request);
104105

105-
$recaptcha = new ReCaptcha($app['parameters']['recaptcha_secret']);
106+
$recaptcha = new ReCaptcha(getenv('recaptcha_secret'));
106107
$recaptchaResponse = $recaptcha->verify($request->request->get('g-recaptcha-response'), $request->getClientIp());
107108
if ($form->isValid() && $recaptchaResponse->isSuccess()) {
108109
$data = $form->getData();

0 commit comments

Comments
 (0)