Browse files

DB connection moved from config.neon to config.local.neon

  • Loading branch information...
1 parent 311bb7a commit 803eb16cd00ead2dd89ddb731de5665c77809ee1 @dg dg committed Nov 13, 2012
Showing with 13 additions and 14 deletions.
  1. +4 −0 app/config/config.local.neon
  2. +9 −14 app/config/config.neon
@@ -1,6 +1,10 @@
+ database:
+ dsn: 'mysql:host=localhost;dbname=test'
+ user:
+ password:
@@ -7,26 +7,21 @@
- date.timezone: Europe/Prague
- # zlib.output_compression: yes
+ date.timezone: Europe/Prague
+ # zlib.output_compression: yes
- application:
- errorPresenter: Error
+ application:
+ errorPresenter: Error
- database:
juzna Nov 28, 2012

I believe it is good to keep this section here, but commented out and with a note like configure database in config.local.neon.

When somebody clones my project from git later, it helps him to configure the app. Otherwise, he has to somehow guess what parameters co configure and how the dsn string look like (or have you ever remembered it??).

This way I one can just copy the commented out part into config.local.neon, uncomment and enter his password.

dg Nov 28, 2012 Owner

I dont understand. Dsn string is in config.local.neon,

juzna Nov 28, 2012

Yep, the problem occurs in second installation. Let me provide you with an example workflow:
1/ I create a new project, update the dsn, username and password in config.local.neon
2/ I add and push it to github, but of course config.local.neon is not there
3/ somebody else clones the projects
4/ he doesn't have config.local.neon and he doesn't know what to put there, thus he gets sad

Suppose me being so smart and predicting this situation, and having added the comments there (in step 1). Then the lucky person who wants to contribute to my project (or perhaps just steal it) would open config.neon, copy the part which says configure this in config.local.neon and he would code happily ever after.

Hope it makes sense now.

dg Nov 28, 2012 Owner

Now I understand. But do you think somebody will find solution for error „File 'sandbox/app/config/config.local.neon' is missing or is not readable“ in config.neon?

hrach Nov 28, 2012

Well, we use the same aproach - with bundled config.local.exaple.neon.

juzna Nov 28, 2012

Providing an even better error message would be great. But suppose people know they need to have config.local.neon, but they don't know what to put there.

fabik Nov 28, 2012

I think it's a bad idea to put config.local.neon to the repository. Furthermore, it is ignored in .gitignore, so it would be a problem to modify this file in the repository. I think config.local.template.neon is a better name.

juzna Nov 28, 2012

I thought so as well, but if you think more about it, it is actually correct to have it there.

config.local.neon is only present in the sandbox repository. If you create a new project, you don't want to keep the history of the whole sandbox, so you start new git repo from scratch (either you use composer create-project which doesn't clone, or you use the downloaded zip package, or if you cloned you delete .git/ afterwards).

So, you don't need to rename any file (no matter if you use VCS or not). And if you use git, svn, ..., you add all sandbox files in first commit without config.local.neon.

fabik Nov 28, 2012

@juzna But if someone clones that repository, he will have to guess the format of config.local.neon; therefore, I think it is better to put the template config to the repository and copy it to config.local.neon on each machine.

- dsn: 'mysql:host=localhost;dbname=test'
- user:
- password:
- session:
- expiration: 14 days
+ session:
+ expiration: 14 days
- authenticator: Authenticator
- routerFactory: RouterFactory
- router: @routerFactory::createRouter
+ authenticator: Authenticator
+ routerFactory: RouterFactory
+ router: @routerFactory::createRouter

0 comments on commit 803eb16

Please sign in to comment.