Jump to content

Config files x 2 and Config module


Peter Knight
 Share

Recommended Posts

There's a relatively new Config module which enables setting basic config options directly in the admin.

Module that enables you to customize most ProcessWire $config settings from an admin tool under Setup > Config. Previously you could only modify these $config settings by editing your /site/config.php file.

Was wondering if you could clear up some points as I'm a bit confused regarding the process and which files take precedence.

Q1: Risk of wire/config being overwritten

If we want to add a custom Configuration property under the Core tab, we are supposed to edit wire/config.php.

For example, I made a new test property in wire/config.php. Refreshing the Config module successfully displays my custom property.

post-1166-0-56085600-1438174806_thumb.pn

Yet on the official docs it states that wire/config.php should not be edited as it'll be overwritten. 

  • Static system configuration file: /wire/config.php (ProcessWire 2.1+ only)
    ProcessWire sets some default configuration options in this file. You should not edit this file directly since it will be overwritten during upgrades. If needed, you can override any of these items by specifying them in /site/config.php.

Q2: Precedence or inheritance of site Vs wire config 

So, should custom settings instead be setup in site/confing.php? 

I don't think they should as adding new Configuration settings here has no effect on wire/config.php or the available Config Module properties

Q3: New Site tab

Again, adding anything to the site/config.php has no effect on my Config Module and the tabs are only. Core | Custom and Remove. Yet the documentation differs here....

The module also parses your site's custom /site/config.php file looking for configurable properties. If it finds any, then you'll have a new "Site" tab appear when using this module. 

I'm wondering if the Custom tab is what you meant instead of Site?

Q4: Site Title

In the current Custom tab, there is a Config property called Site Title. Where is the Config Module reading this from? It's not set in Site or Wire config.php that I can see.

Link to comment
Share on other sites

I thought we are never ever advised to edit wire/config.php, we are strongly advised to edit site/config.php

Or do I miss something new? :)

Edited by horst
Link to comment
Share on other sites

  • 4 weeks later...

That's correct, you should avoid making edits to /wire/config.php. If you see something you want to change, then copy it from /wire/config.php into your /site/config.php and change it there. There's no harm in changing /wire/config.php btw, but anything you change there will get wiped out every time you update the core. That's why it's preferable to limit your edits to /site/config.php. There is no provision for adding custom properties under the "Core" tab of the config module, as the definition of "Core" in this case is properties that are part of the core configuration. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...