Advanced Template - Local Files

Hi!

I’ve just started my first Advanced-Theme project (up to now, I’ve only used the basic template of yii2) and I’m having a hard time figuring out how to use these local files. I’ve switched to the development environment using init and popoulated the local config files with some dev-environment informations (local db etc.). When deploying the project using git (-> Bitbucket), those -local files won’t get uploaded because of gitignore, so the application fails because index.php is trying to require those -local files.

Afterwards, I’ve tried switching to dthe productive environment using init and would have guessed that init removes these requirements from index.php - it doesn’t. Could you tell me whats the correct way of deploying and using those local files? Not deploying them -> Error. Deploying them -> Not really local. Modifying index.php manually before each deployment -> :blink: . Any suggestions? :-*

Well the point of those file is to allow multiple programmer to work on the same project. Each programmer create his own local files with his own configuration.

Now because everyone has different configuration, you do not want to add them to the repo, so that’s why they won’t get uploaded because of gitignore.

I haven’t messed around with the production evironment but I guess that when you execute init, it adds files (it doesn’t remove them). I could be wrong about this though.

Hey Alain,

I did get the idea behind it - but still index.php will fail if it requires a php file which is not available inside the repository. Either index.php will drop its requirements or these files have to get uploaded. :huh:

You have to create these once yourself.

Hey Alexander,

Thanks for your help. It might not be the best solution, but it’s not stupid if it works :wink:

Prior to this I had to delete the local files from gitignore, as I’m deploying directly from the git repository.

best practice… if you want use git for sharecode

I think we should init app to development… And if you modify config… you should do for main.php and main-local.php… for example when you set password… but in main.php dont set really password…

you should not modif gitignore

other person that want use your code… should install yii2 first… before clone your shared code…

after it… composer update… to update vendor folder…

cmiiw

Professor, as I’ve mentioned before, I unterstood the idea behind this concept. The problem I was facing is that my application gets deployed from the git repository - which means: Any file which is not present in the git repository, will not get downloaded by the application server (using git pull). Therefore, I do need to have the local files present, even if they’re empty - for the only reason that index.php can require them. By using the git commands I’ve posted yesterday, one can add an empty version of the local files to the repository and change them afterwards without uploading the newer versions (which will then include local configs). :)