Our organiziation is running 60+ Symfony 1.4 sites and we are looking to globalize the settings files (settings.yml, app.yml). We'd like to have a simple PHP require in the /config/settings|app.yml files and create site-specific settings in the apps/frontend/config/settings|app.yml files. Implementing this setup with the app.yml is not a problem. Settings from the /config/app.yml combine/merge with the apps/frontend/config/app.yml. When we try to implement the settings.yml, however, the settings are overridden by the apps/frontend/config/settings.yml -- specifically the enabled_modules, which we'd like to be able to have sites merge their own specific modules with the global ones.
The link below has the following verbiage:
"...Some configuration files can be defined in several config/ sub-directories contained in the project directory structure.
When the configuration is compiled, the values from all the different files are merged according to a precedence order:..."
So, I'm assuming merging the settings.yml file values is possible and I'm doing something wrong.
http://www.symfony-project.org/referenc ... on_cascade
I appreciate any help that ya'll can provide. Thanks in advance!!
Related
I have several instances of the same platform for different people.
Some of them have different translation files than others according to their specific requests.
For the moment, the files have different names and we distinguish them by the pattern in the module.config.php.
The problem is that we have to update and replace the module.config.php every time we update the code (with GIT) to change the pattern according to the client.
Is there a way to define a constant in a *.local.php file and to be able to access it in module.config.php with ZF2 ?
Thank you in advance for your help!
Update : Thanks to #delboy1978uk.
You can use environment variables either in (for Apache at least) the system-wide apache.conf or httpd.conf, in the virtual host or in the .htaccess file. It will then be accessible by getenv()
My project is two Laravel applications in one folder. Why two separate applications instead of one? I have good reasons. Anyway, for example, every time I want to change the app name in the config (config/app.php) I go and edit the .env file in both directories (of the two applications) and then execute artisan config:cache to update the cached config.
It's not much of a task or anything, but it's a bad design I believe. So, I am looking for a way to take the values shared between these two application out to a separate file. And have these application load this file and override/apply the values inside it to the app configuration.
So, now I have a config.php in the root directory (which holds the other two apps in /app1 and /app2). And inside each app's AppServiceProvider I call the config.php and loop through the values and set each using Config::set(..., ...).
This worked for me well, but of course changing the values loaded in the \Config package doesn't change the values that were fetched from it earlier to this point. For example app()->environment() returns the value set in the config/app.php, not the new value introduced in the global config.php. That's because the App library asked for the env property before I could override it!
So, what I want your help with is: you either tell me about a more smart/standard way to achieve 1 config for 2 apps setup. Or tell me where to put the code that overrides the app config with the new values from my global config.php (currently I put the code in register() in App\Providers\AppServiceProvider)
You can share env settings by removing one of .env files and make a symlink to the other file instead of a common file. In this case if you change a file, both applications get changed values.
we have built a multi environment application over laravel 5 with environment based configurations and views, now the problem arises when we try to use environment based public resources like css, js and images, as they are in public directory and does not recursive merge things like in configurations file. can we somehow control it with environment settings etc.
for example:
I have two domains with almost same functionality but differs in some configuration and design, like for example site_1 shows header navigation links on the top while the site_2 does not show header navigation links in top so we can somehow manage it in the configuration site_1.config.settings.header and set values to on or off.
well as per my understanding you are using multiple environment files which varies deployment to deployment, in larvel you can override enivronment variables from environment files and can use one main environment file to override variables like in .env file you can define the APP_ENV = site_1 and can create new environment file named .site_1.env and override all the environment variables which are different for that deployment.
about the public resources you can do the sort of same alike configuration scheme but as you know these files do not recursive merge so you can create a same file in the public/site_1/filename.ext and when adding these files in your templates you can append the environment name as directory to lookup for those files.
You can use the theme package. Like
Cartalyst Theme
I have a base config of my ZF2 application, which is in the following structure of my ZF2 application:
/frontend
/config
/autoload -> (here I have config.php file - which is base config)
/brand -> (here I have config files for my vhosts)
When I need things from my vhosts config I simply do like this:
$this->config()['SomethingGoesHere']
My question here is, when I'm located in my vhost (www.sitename1.com). I would like to access the base config within my vhost, how can I do that guys??
If you want to set different configuration for different virtual-hosts I would not recommend to do it like this. You can set more advanced configuration differently, for example by using environmental variables. You can read more on this here in the documentation chapter: Advanced Configuration Tricks.
The correct solution also totally depends on what variables you are setting and what you want to use them for and where you want to use them. If you provide more details on what you are trying to do (what is in your "base config"?) it would be possible to give a more suitable answer for your needs.
Which folders should I ignore when using version control on a project developed on the CodeIgniter framework?
I am already ignoring the application/cache folder, but are there any else?
You can ignore any application generated logs and any development specific configuration files. Here's a commonly used .gitignore file for CodeIgniter:
*/config/development
*/logs/log-*.php
*/logs/!index.html
*/cache/*
*/cache/!index.html
https://github.com/github/gitignore/blob/master/CodeIgniter.gitignore
Beyond the default github codeigniter template provided by birderic, (at https://github.com/github/gitignore/blob/master/CodeIgniter.gitignore for good measure) I also like to simply exclude any php file in the /config director with
*/config/*.php
Some third party apps, like HybridIgnite, like to put their configuration files in the /config directory and a limited config block might enable on of these files to be tracked... Better safe than sorry...
To make it clear how config files should work, I keep a copy of the default files (with no passwords of course) in a seperate config_template directory.
HTH,
-FT