Skip to content

Commit

Permalink
Reduced number of env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
gquemener committed Jun 26, 2018
1 parent 47394ca commit 245e200
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
app.event_store.pdo_connection.mysql:
class: \PDO
arguments:
- 'mysql:host=%env(MYSQL_HOST)%;dbname=%env(MYSQL_DBNAME)%'
- '%env(MYSQL_DSN)%'
- '%env(MYSQL_USER)%'
- '%env(MYSQL_PASSWORD)%'

Expand Down
3 changes: 1 addition & 2 deletions prooph/pdo-event-store/1.7/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"scripts/": "%CONFIG_DIR%/scripts/"
},
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_DBNAME": "event_streams",
"MYSQL_DSN": "mysql:host=127.0.0.1;dbname=event_streams",
"MYSQL_USER": "user",
"MYSQL_PASSWORD": "password"
}
Expand Down

2 comments on commit 245e200

@kochen
Copy link

@kochen kochen commented on 245e200 Jun 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we remove MYSQL_USER & MYSQL_PASSWORD as well?

mysql://{user}:{pass}@{server}:{port}/{db}

Using the factory, as done in the prooph demo app:

    doctrine.pdo.connection:
        class: PDO
        factory: ['@database_connection', getWrappedConnection]

@gquemener
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we remove MYSQL_USER & MYSQL_PASSWORD as well?

The php doc seems to answer no to this question: http://php.net/manual/en/ref.pdo-mysql.connection.php (it might be worth trying it though).

The factory method is a good idea indeed, but creates a dependency with the Doctrine bundle.

Please sign in to comment.