Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

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

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 Owner
dg added a note

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

@juzna
juzna added a note

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 Owner
dg added a note

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
hrach added a note

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

@juzna
juzna added a note

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
fabik added a note

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
juzna added a note

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
fabik added a note

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- dsn: 'mysql:host=localhost;dbname=test'
- user:
- password:
-
- session:
- expiration: 14 days
+ session:
+ expiration: 14 days
services:
- authenticator: Authenticator
- routerFactory: RouterFactory
- router: @routerFactory::createRouter
+ authenticator: Authenticator
+ routerFactory: RouterFactory
+ router: @routerFactory::createRouter
factories:
Please sign in to comment.
Something went wrong with that request. Please try again.