Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 21fcb92

Browse filesBrowse files
dzuelkejaviereguiluz
authored andcommitted
Use dynamic env params for critical settings and restore Heroku deploys
1 parent 0313e7a commit 21fcb92
Copy full SHA for 21fcb92

File tree

Expand file treeCollapse file tree

8 files changed

+24
-18
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+24
-18
lines changed

‎app.json

Copy file name to clipboardExpand all lines: app.json
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@
99
"repository": "https://github.com/symfony/symfony-demo",
1010
"logo": "https://symfony.com/images/v5/pictos/demoapp.svg?v=4",
1111
"success_url": "/",
12+
"scripts": {
13+
"postdeploy": "php bin/console doctrine:schema:create && php bin/console doctrine:fixtures:load -n"
14+
},
1215
"env": {
1316
"SYMFONY_ENV": "prod",
17+
"SYMFONY_LOG": "php://stderr",
1418
"SYMFONY_SECRET": {
1519
"description": "Extra entropy for %kernel.secret%; used for CSRF tokens, cookies and signed URLs.",
1620
"generator": "secret"
1721
}
1822
},
23+
"addons": [
24+
"heroku-postgresql"
25+
],
1926
"image": "heroku/php"
2027
}

‎app/AppKernel.php

Copy file name to clipboardExpand all lines: app/AppKernel.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public function registerBundles()
2121
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
2222
new CodeExplorerBundle\CodeExplorerBundle(),
2323
new AppBundle\AppBundle(),
24+
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), // used for initial population of non-SQLite databases in production envs
2425
// uncomment the following line if your application sends emails
2526
// new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
2627
];
@@ -34,7 +35,6 @@ public function registerBundles()
3435
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
3536
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
3637
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
37-
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
3838
}
3939

4040
return $bundles;

‎app/config/config.yml

Copy file name to clipboardExpand all lines: app/config/config.yml
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ framework:
3131
# http://symfony.com/doc/current/book/http_cache.html#edge-side-includes
3232
esi: { enabled: true }
3333
translator: { fallback: "%locale%" }
34-
secret: "%secret%"
34+
secret: "%env(SYMFONY_SECRET)%"
3535
router:
3636
resource: "%kernel.root_dir%/config/routing.yml"
3737
strict_requirements: ~
@@ -61,10 +61,10 @@ twig:
6161
# Doctrine Configuration (used to access databases and manipulate their information)
6262
doctrine:
6363
dbal:
64-
# if you don't want to use SQLite, comment the two following lines
65-
driver: "pdo_sqlite"
66-
path: "%kernel.root_dir%/data/blog.sqlite"
67-
# uncomment the following lines to use a database different than SQLite
64+
# if you don't want to use SQLite, change the URL in parameters.yml or set the DATABASE_URL environment variable
65+
url: "%env(DATABASE_URL)%"
66+
67+
# instead of using a URL, you may also uncomment the following lines to configure your database
6868
# driver: pdo_mysql
6969
# host: "%database_host%"
7070
# port: "%database_port%"

‎app/config/config_dev.yml

Copy file name to clipboardExpand all lines: app/config/config_dev.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ monolog:
1515
handlers:
1616
main:
1717
type: stream
18-
path: "%kernel.logs_dir%/%kernel.environment%.log"
18+
path: "%env(SYMFONY_LOG)%"
1919
level: info
2020
console:
2121
type: console

‎app/config/config_prod.yml

Copy file name to clipboardExpand all lines: app/config/config_prod.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ monolog:
1919
handler: nested
2020
nested:
2121
type: stream
22-
path: "%kernel.logs_dir%/%kernel.environment%.log"
22+
path: "%env(SYMFONY_LOG)%"
2323
level: debug
2424
console:
2525
type: console

‎app/config/parameters.yml.dist

Copy file name to clipboardExpand all lines: app/config/parameters.yml.dist
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ parameters:
66
# this demo application uses an embedded SQLite database to simplify setup.
77
# in a real Symfony application you probably will use a MySQL or PostgreSQL database
88
# the path must be relative or else it will not work on Windows
9-
database_url: 'sqlite:///%kernel.root_dir%/data/blog.sqlite'
9+
env(DATABASE_URL): 'sqlite:///%kernel.root_dir%/data/blog.sqlite'
1010

1111
# Uncomment this line to use a MySQL database instead of SQLite:
1212
#
13-
# database_url: 'mysql://root:pass@127.0.0.1:3306/symfony_demo'
13+
# env(DATABASE_URL): 'mysql://root:pass@127.0.0.1:3306/symfony_demo'
1414
#
1515
# Furthermore, you must remove or comment out the "doctrine" section from config_dev.yml regarding SQLite!
1616
#
@@ -35,4 +35,7 @@ parameters:
3535
# used internally by Symfony in several places (CSRF tokens, URI signing,
3636
# 'Remember Me' functionality, etc.)
3737
# see: http://symfony.com/doc/current/reference/configuration/framework.html#secret
38-
secret: 'secret_value_for_symfony_demo_application'
38+
env(SYMFONY_SECRET): 'secret_value_for_symfony_demo_application'
39+
40+
# Destination for log files; can also be "php://stderr" etc
41+
env(SYMFONY_LOG): %kernel.logs_dir%/%kernel.environment%.log

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@
6464
"symfony-tests-dir": "tests",
6565
"symfony-assets-install": "relative",
6666
"incenteev-parameters": {
67-
"file": "app/config/parameters.yml",
68-
"env-map": {
69-
"database_url": "DATABASE_URL",
70-
"secret": "SYMFONY_SECRET"
71-
}
67+
"file": "app/config/parameters.yml"
7268
}
7369
}
7470
}

‎composer.lock

Copy file name to clipboardExpand all lines: composer.lock
+2-2Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.